in reply to What is the output for this ??

Formatting and responding to what I think is your query:
Regex Result (.*)(\d*) 'I have 2 numbers: 53147', '' (.*)(\d+) 'I have 2 numbers: 5314', '7' (.*?)(\d*) '', '' (.*?)(\d+) 'I have ', '2' (.*)(\d+)$ 'I have 2 numbers: 5314', '7'
Produced by this program:
use strict; my @re= qw| (.*)(\\d*) (.*)(\\d+) (.*?)(\\d*) (.*?)(\\d+) (.*)(\\d+)$ |; my $test ="I have 2 numbers: 53147"; print "Regex\t\tResult\n"; for (@re){ my $r=qr|$_|; print "$_\t'", join( "', '",$test=~/$r/),"'\n"; }
Now - could you point out which line(s) you have trouble with ?

Also, I suggest you review:

     Syntactic sugar causes cancer of the semicolon.        --Alan Perlis