in reply to Re: Split with numbers
in thread Split with numbers


Using your code as inspiration, I wrote something that creates the data structure instead of only printing out the results.

use strict; use warnings; use Data::Dump 'pp'; my @examples = qw[ AB23C ABC23 23BC ABC ]; my @out; push @out, [ m/([A-Z]*)([0-9]*)([A-Z]*)/ ] for @examples; pp @out; __END__ ( ["AB", 23, "C"], ["ABC", 23, ""], ["", 23, "BC"], ["ABC", "", ""], )