in reply to Extracting two numbers from a string

use strict; use warnings; my $num1; my $num2; my $s = 'examplestringofrandomlength/userid=6&refid=49'; if ($s =~ / (\d+) \D+ (\d+) /x) { $num1 = $1; $num2 = $2; } print "num1=$num1\n"; print "num2=$num2\n"; __END__ num1=6 num2=49

perlre

Replies are listed 'Best First'.
Re^2: Extracting two numbers from a string
by soap (Initiate) on May 28, 2010 at 17:31 UTC
    Thank you so much. I apologize for being a newbie