The easiest way might be something like this:
#!/usr/bin/perl -w use strict; my $data = '12-34-2001020713'; my @nums = $data =~ /\d\d/g; print "@nums\n";
But you end up with the year split between two elements of the array. I suppose it's not too difficult to join them together again.
--
"Perl makes the fun jobs fun
and the boring jobs bearable" - me
In reply to Re: extracting numbers from a string
by davorg
in thread extracting numbers from a string
by rbi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |