Though general suggestions for code improvements are welcome, my specific question relates to this eyesore:
:) Sorry, its all eyesore :P
Mostly the problem is you're trying to s///ubstitute when you should be manipulating an array after m//atching , for example
push @stack, [ COMMENT => $1 ]; ... $stack[-1][0] eq 'COMMENT' and pop @stack for 1..3;
But freel free to do your own benchmarks
$ perl -le " $_ = qq{;banana\n;ro\n;sham\n;bo\n}; print; s{(?:^;[^\r\n +]*[\r\n]+){1,3}\Z}{}m; print; " ;banana ;ro ;sham ;bo ;banana
Thats just what I think at the moment :)
In reply to Re: Removing multiple trailing comment lines from a string (array of tokens)
by Anonymous Monk
in thread Removing multiple trailing comment lines from a string
by eyepopslikeamosquito
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |