
japhy
Enthusiast
Mar 14, 2001, 5:13 PM
Post #3 of 3
(312 views)
|
What in the world do you expect $lines =~ m/message/ to do? You should be checking $lines[$i], not $lines. And you're skipping the first element. Arrays start 0, not 1. And you're coding Perl as if it were C. Please don't do that.
for (@lines) { if (/message/) { print; } } # or for (@lines) { print if /message/; } # or print grep /message/, @lines; Jeff "japhy" Pinyan -- accomplished hacker, teacher, lecturer, and author
|