s/\s*$//; # means substitute zero or more spaces # before end-of-line with NOTHING (get rid of them)