huh, there's already a solution that doesn't use any modules in this thread.
But apply can be implemented using map pretty easily.
print OUTFILE map { my $s = $_; $s =~ s/\s*#.*/; $s } grep { !/^\s*#/ } <INFILE>;
You could even merge the map with the grep, but then it looks like spagetti.
In reply to Re^3: Regex in a printfile?
by ikegami
in thread Regex in a printfile?
by Andrew_Levenson
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |