Perl has the s/// operator to trim leading or trailing whitespace:
$line =~ s/^\s+//; # ltrim() $line =~ s/\s+$//; # rtrim()
This is as short as ltrim and already exists.
Maybe you want to learn about Perl before suggesting new features? For example, you don't seem to know about wantarray and how you can use it and the argument aliasing to implement
ltrim($line,7); # and $line2 = ltrim($line,7);
Yes, if you want to pass around regular expressions, you need to use the qr// quotes (not single quotes please), but that's a minor price to pay to get a feature right now instead of waiting for somebody to implement it.
In reply to Re^3: What esteemed monks think about changes necessary/desirable in Perl 7 outside of OO staff
by Corion
in thread What esteemed monks think about changes necessary/desirable in Perl 7 outside of OO staff
by likbez
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |