in reply to Regex negative number question

To answer the question you asked by /msg, try the following:
while (my $line = <MYFILE>) { chomp $line; # Do stuff here }

The problem is that $line was a global variable. strict complains about that, so you have to my the variable when you use it. The above is (almost) the standard way of handling a file line by line. The standard way most people do it would be to use $_ as much as possible. Something along the lines of:

while (<MYFILE>) { # Skip commented-out lines (or whatever else you want to do) next if /^#/; # Don't chomp unless we know we're going to use the line chomp; if (/SOME REGEX HERE/) { # Do stuff } }

Now, you don't want to chomp in the while condition. If you have a last line without a newline, that line will be skipped because chomp will indicate that it wasn't able to remove anything by returning undef.

------
We are the carpenters and bricklayers of the Information Age.

The idea is a little like C++ templates, except not quite so brain-meltingly complicated. -- TheDamian, Exegesis 6

Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.