in reply to how to use chop / chomp effectively

Will it fit your needs to just strip all the whitespace from the end of the string?
open FILE, '<', 'test.file' or die; while(<FILE>){ s/\s+$//; print "line=[$_]\n"; } close FILE;
Note that you don't want to use chomp because you're looking to remove more than just $/ ... and you don't want to use chop because you don't want to accidentally remove a piece of the folder name..

Replies are listed 'Best First'.
Re^2: how to use chop / chomp effectively
by duff (Parson) on Mar 24, 2006 at 02:09 UTC

    You've committed the cardinal sin of not checking the return value of your call to open :-)