You might want to have a look at map which you could use here. Again, you need to pass out the chomped string, not the return value of chomp.
knoppix@Microknoppix:~$ cat xxxx line 4 line 2 line 5 line 1 line 6 line 3 knoppix@Microknoppix:~$ cat xxxx | perl -E ' > say for sort map { chomp; $_ } <>;' line 1 line 2 line 3 line 4 line 5 line 6 knoppix@Microknoppix:~$
I hope this is helpful.
Cheers,
JohnGG
In reply to Re: Unexpected chomp behavior
by johngg
in thread Unexpected chomp behavior
by saintex
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |