yes, the main point was that the number (in the example above '34') is stored in $1.
if you want a full line try something like
$ret = "";
while(<DATA>)
{
$_=~/^[^\d]+(\d+)[\w\W]+/;
$ret .= $1." ";
}
/* now $ret will contain all the 34's in a line seperated by spaces.. */