Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Filehandles vs Uninitialized Values in pattern match

by Sidhekin (Priest)
on Nov 23, 2007 at 16:04 UTC ( #652599=note: print w/replies, xml ) Need Help??


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!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://652599]
help
Chatterbox?
[marto]: Re: Monastery login over http
[Corion]: Veltro: This is due to the fact that one of our webservers doesn't have "our" https certificate but another https certificate. Work is underway (well, on my long, long to-do list) to switch even that server over to "our" certificate

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (10)
As of 2018-05-23 11:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?