I'm a beginner too, given, but alternatively, you could unshift the lines into an array and just check the last variable. This would allow you to reference the other lines later if there was more work to be done here.
-----Original Message----- From: James Kelty [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 18, 2001 1:22 PM To: [EMAIL PROTECTED] Subject: Last line of file... Is there a document in perldoc that tells the best way to get the last line of a file? Below is my usual code for reading a file. #!/usr/bin/perl -w $file = qq(/some/file/); open FILE, "$file" or die "Cannot open file: $!\n"; while(<FILE>) { do something with the line; } close(FILE); What I want to do is read just the last line. Might help in the case of a password file or something like that. Thanks! -James -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]