RosettaCodeData/Task/Strip-comments-from-a-string/Perl/strip-comments-from-a-string.pl
2023-07-01 13:44:08 -04:00

7 lines
157 B
Perl

while (<>)
{
s/[#;].*$//s; # remove comment
s/^\s+//; # remove leading whitespace
s/\s+$//; # remove trailing whitespace
print
}