#!/usr/bin/perl # This is a PERL script. # It removes space, if any, at the end of every line. while ($_ = ) { s/\s\n/\n/; print $_; }