or download this
$line =~ s/.$//; #remove the last character before the newline
$line =~ s/[A-Za-z]$//; #remove an alphabetic character before the ne
+wline
$line =~ s/;$//; #remove a semicolon at the end of the line
$line =~ s/[ ]$//; #remove a single space at the end of the line
$line =~ s/\s+$//; #remove one or more whitespace characters at the e
+nd of the line