my @matches = '1 foo 22 bar 3' =~ /^\d+/g; print "@matches";