You can chomp <DATA> straight away before passing it to the sort routine. [...]
[...]
sort part_sort chomp <DATA>;
<DATA> is immutable, so you cannot
chomp it
(chomp actually tries to modify what it gets - it returns the number of removed characters, not a list of chomped strings).
#!/usr/bin/perl
print chomp <DATA>;
__DATA__
This piece of code will trigger the following compilation error:
Can't modify <HANDLE> in chomp at - line 2, near "<DATA>;"
Execution of test aborted due to compilation errors.
2;0 juerd@ouranos:~$ perl -e'undef christmas'
Segmentation fault
2;139 juerd@ouranos:~$