in reply to what is the best way to seperate the digits and strings from variable ?

$variable = '12345(checkthis)'; $digit=$1 if $variable=~m#([0-9]+)#; print $digit;

Output:

12345