Yes, but why? It works fine, but substr is quicker and easier to understand.
my $short = ( m/^(.{1,20})/ ) ? $1 : '';
...or...
my( $short ) = m/^(.{0,20})/;
Dave
In reply to Re^3: how to shorten given string?
by davido
in thread how to shorten given string?
by mellin
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |