RosettaCodeData/Task/Strip-comments-from-a-string/Perl/strip-comments-from-a-string.pl

8 lines
157 B
Perl
Raw Permalink Normal View History

2013-04-11 01:07:29 -07:00
while (<>)
{
s/[#;].*$//s; # remove comment
s/^\s+//; # remove leading whitespace
s/\s+$//; # remove trailing whitespace
print
}