Monday, January 15, 2007

Perl : Removing last newline in while

Here's a way to check if we are at the last iteration and removing the newline if true, while iterating through lines.

while(<>){
chomp if eof; ### eof returns 1 if next read on filehandle returns end of file
print;
}


1 comment:

Anonymous said...
This comment has been removed by a blog administrator.