Jonathan Scott Duff wrote:
>
> 1. Allow the first argument to split() to be a number such that
> the string is broken into chunks of that many characters.
@strings = /(.{$n})/g;
> 2. Allow the first argument to split() to be an array of
> numbers, such that split returns a list of strings each as
> long as the corresponding number.
@strings = do { my $re = join '', map { "(.{$_})" } @lengths; /$re/ };
--
John Porter
- split() ideas Jonathan Scott Duff
- Re: split() ideas Graham Barr
- John Porter
