in reply to Re: Substring problem
in thread Substring problem

Thanks. Is there a way to determine the end of the file? I added a extra return and the end of the file as a workaround...however initially, the while loop would not read the last line. ie..
server1234 server3444 server5555
The output would read the first two lines, however the last line server5555 would just display as a blank, until i added a return to the end of the file.

Replies are listed 'Best First'.
Re^3: Substring problem
by bv (Friar) on Aug 26, 2009 at 20:41 UTC

    No need to. The <> operator knows to stop on EOF. You had the problem before because each iteration of the loop had two read ops, so you needed an even number of lines in the file to get it to terminate.

    $,=' ';$\=',';$_=[qw,Just another Perl hacker,];print@$_;