You could split using a character class containng space characters and left and right parentheses, see perlre.
$ perl -Mstrict -Mwarnings -E ' my $line = q{25 ((18 25 4) (3 12 1))}; my @nums = split m{[\s()]+}, $line; say qq{@nums};' 25 18 25 4 3 12 1 $
I hope this is helpful.
Cheers,
JohnGG
In reply to Re: Trying to read numbers from a text file
by johngg
in thread Trying to read numbers from a text file
by biscarri
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |