There are at least 42 ways.
Please show what you've tried, and how it didn't work. You might be close!
Edit: OK, thanks for your code.
If you just want to extract numbers, you could use a simple regular expression instead of split() (which you would have to call more than once to get your desired results from your string):
Note the use of g to match all occurrences, and a to force the regexp to match only ASCII numbers with the /d character class.my @x = ( $string =~ /\d+/ga );
You should familiarize yourself with the basics of regular expressions: perlrequick is a good place to start.
Finally, may I ask why your data is in this format? It smells like an XY problem and there are probably better ways to create your input data. What is the task you are really trying to accomplish?
In reply to Re: Etxraction of numbers in an array
by 1nickt
in thread Extraction of numbers in an string
by t-rex
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |