in reply to Re: Messing with hashes
in thread Messing with hashes
Beware of the newline.
If there is a trailing newline, and there should be according to perlfaq5/"How do I count the number of lines in a file?", you'll get an extra key "\n" with value undef. The obvious way to handle this is to first store the line in a variable, chomp() it, then split() it. A split on /[|\n]/ would work too, but I'd prefer chomp()ing.
ihb
|
|---|