If you want to chomp \r\n, set $/ to \r\n:
local $/ = "\r\n"; $one = "Hello\r\n"; print "Before chomp: " , length($one) , "\n"; chomp($one); print "After Chomp: " , length($one) , "\n";
In reply to Re^3: chomp() is confusing
by ikegami
in thread Why chomp() is not considering carriage-return
by jesuashok
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |