One thing you could do is extract all numbers, then use the second one:
my $astring = "cool more 23423 random words of 1234 random other [wordssssssss] 23";
my @numbers = $astring =~ /[0-9]+/g;
print "The second number is $numbers[1]\n";
1
solved Take second of three numbers from a line in a file [closed]