http://qs321.pair.com?node_id=652599


in reply to Filehandles vs Uninitialized Values in pattern match

The +>> mode puts the file position initially at eof, so there is nothing left to read. Your @lines will be empty. (And hence, $lines[-1] etc will be undefined.)

If I read your intentions correctly, you seem to be missing just a seek DAT, 0, 0 before you read from the file. (See seek; in short it sets file position to start of file.)

(The file position will be advanced as you read, so ending up at eof afterwards, but even if it wasn't, opening with +>> makes sure Perl will seek to eof before starting to output anything on the handle.)

print "Just another Perl ${\(trickster and hacker)},"
The Sidhekin proves Sidhe did it!