#!perl -wl use strict; use LWP::Simple; my($x, $m, $t, $c, $DEBUG); $DEBUG = 0; $x = get q(http://quote.yahoo.com); $x =~ s/\015?\012/\n/g; print $x if $DEBUG; foreach (split(/\n/, $x)) { if (/>(Dow|Nasdaq)<\/a>/) { $m = $1; print "m: $m" if $DEBUG; } elsif ($m && /([^<]+)<\/b>/) { $t = $1; print "t: $t" if $DEBUG; } elsif ($m && /(?:]*>)?([^<]+)(?:<\/font>)?<\/small>/) { $c = $1; print "c: $c" if $DEBUG; } if ($m && $t && $c) { print "$m: $t [$c]"; $m = $t = $c = undef; } } local $^W; print "$m $t $c" if $DEBUG;