I have a script to remove carriage returns on a Unix server, but since some of the code is in TS, I do not want to write to the file if there was not a change.
for a variable I would use:
if ($text=s|\r\n|\n|g) { write and close file....}
But I cannot get it to work with this:
open(IN, "<$fname") || die " '$fname' ($!)";
my
@text = map {s/\r\n/\n/; $_; }
<IN>;
close(IN);
print "Processed $fname\n";
I know I can process it in a for loop, but I was hoping there would be a much better way.
Andy