in reply to Removing multiple trailing comment lines from a string
Just a couple of comments on some code details, although it might be that it would be better to change it overall.
Why would you need this:
when the second line will do everything that the firstline is doing? (Same from trailing spaces).$s =~ s/^[ \t]+//mg; # remove leading whitespace from each line $s =~ s/^\s+//; # remove leading whitespace
Similarly, I don't see the reason to run the same pair of statements three times:
Once should be enough, no? And I doubt the chomp is useful here.$s =~ s/^;.*\Z//m; chomp $s; $s =~ s/^;.*\Z//m; chomp $s; $s =~ s/^;.*\Z//m; chomp $s;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Removing multiple trailing comment lines from a string
by eyepopslikeamosquito (Archbishop) on Dec 23, 2016 at 09:38 UTC | |
|
Re^2: Removing multiple trailing comment lines from a string
by eyepopslikeamosquito (Archbishop) on Dec 23, 2016 at 09:53 UTC |