Nice. As a finishing touch, you could indicate to split to produce only 4 elements: 0 to 2, and the rest of the string in the last element to be sliced away.
sub extract { return join('-', (split(/:/, $_[0], 4))[1,2], $_[1]); }
• another intruder with the mooring in the heart of the Perl
In reply to Re^3: split slice?
by grinder
in thread split slice?
by convenientstore
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |