$string = '1234 abcdef 123abc 123e 346 abcd 123abc 345 ghte 234gvd gbt345 6453 tty';
you want to get all the digit only sequences from the string:
@array_of_matches = $string =~ /\b(\d+)\b/g;
loop through @array_of_matches to see what you got:
for (@array_of_matches) {
print "$_\n";
}
$array_of_matches[0] is the first element in the array corresponding to the fist pattern match returned from the regexp: 1234
$array_of_matches[-1] is the last match: 6453
which is the same as:
$array_of_matches[$#array_of_matches]
maybe you can give a better idea of what you are trying to match and store in an array.