in reply to Trying to read numbers from a text file
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
|
|---|