[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[OT] Perl pattern matching



Hi List

Sorry for coming in here with such a question, but this list ahs perl gurus, and response is much faster than comp.lang.perl.misc (and I need the answer fast...)

Here it comes:
In "Programming Perl (german translation) there is an example for how to skip lines that start with the hash sign:

LINE: while ($line = <INFILE>) {
next LINE if /^#/; # Should skip lines that start with the hash sign.
 # what to do with non-comment-lines....
}

When I try to use it, I get an error message:
Use of uninitialized value in pattern match (m//) at ./rhodanid.pl line 138, <INFILE> line 1
for all lines of the file coming in via <INFILE>

Any idea how to skip comment-lines?

thanks
joerg

PS.: The book is written for Perl 5.006, I think, and I use 5.8 (from sid). Did the pattern matching change?



Reply to: