in reply to Regular expression

From your description, I think something like this should work:
... my $number = 5038062; # In your example my ( $grabbed ) = $var =~ /([0-9]{7})/; print "$grabbed\n"; ...
Given the number assinged to the $number variable, you will be able to capture any of the first seven numbers, 0-9, and placed into the $grabbed element. This approach will return a result set as an array, therefore the parenthases are required.

Another approach would be something like:
... my $number = 5038062; # In your example my ( $grabbed ) = $var =~ /(\d{7})/; print "$grabbed\n"; ...
Where you are being less strict (kind-of) with the numbers, and are now requesting to capture the first seven digits (\d) rather than the first seven digits, 0-9.

I hope this is what you were looking for... and good luck!

---hA||ta----
print map{$_.' '}grep{/\w+/}@{[reverse(qw{Perl Code})]} or die while ( 'trying' );