or download this
chop($line); # Best way. Removes the last character.
$line =~ s/.\z//s; # Works, but not as simple as 'chop': substi
+tution.
substr($line, -1,1,''); # Works, but not as simple as 'chop': substr
+ with empty-string replacement.
substr($line,-1,1) = ''; # Works, but not as simple as 'chop': substr
+ as an lvalue.