while (<>) { s/${\NEWLINE()}$//; # should work print; }