in reply to Regexp to extract groups of numbers
Fixed width formatted data is easily handled by unpack. Here's an example where the string is treated as three ten-digit strings and divided thataway using unpack.
my $string = q/000000000000022102840002210284/; my( @numbers ) = unpack "a10a10a10", $string; print "$_\n" foreach @numbers;
As for using a regexp, here's a more concise one:
my $string = q/000000000000022102840002210284/; my( @numbers ) = $string =~ m/(\d{10})(\d{10})(\d{10})/; print "$_\n" foreach @numbers;
Enjoy!
Dave
|
---|