my $str = "(5) 3 4 (8)"; my ($x, $y) = ($str =~ /\d+/g)[0..1]; print "$x\t$y\n";
Standard input is empty
5 3
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!