a) 's/\s*#.*//' b) '$_ = $` if /#/' c) '($_) = split/#/' d) '$_ = substr($_, 0, $-[0]) if /#/' e) 'if ((my $p = index($_, "#")) > -1) { substr($_, $p, -1, "") }'