"Chas Owens" schreef: > vunet.us: >> If this is how I get external content of the file, how do I loop >> through every line of the $content? >> >> #!/usr/bin/perl >> use LWP::Simple; >> $url = 'http://site.com/page.html"; >> $content = get $url; >> print $content; > > for my $line (split /\n/, $content) { ... > }
Broken alternative; while ($content =~ m/(.*)/g) { # code using $1 } Test: $ perl -wle '$t="abc\ndefgh\n\nxyz"; print "<$1>" while $t =~ /(.*)/g' <abc> <> <defgh> <> <> <xyz> <> But this variant might be handy: $ perl -wle '$t="abc\ndefgh\n\nxyz"; while ($t =~ /(.+)/g) { print "<$1>" }' <abc> <defgh> <xyz> (main advantage: it doesn't create an immediate array) But I assume that a proper HTML parser will be the final answer. -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/