in reply to Re: Split with numbers
in thread Split with numbers
Neat.
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", "", ""], )
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Split with numbers
by BrowserUk (Patriarch) on Nov 24, 2015 at 19:33 UTC | |
by muba (Priest) on Nov 24, 2015 at 20:54 UTC |
In Section
Seekers of Perl Wisdom