dirtdog has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks
I'm hoping someone can assist with if there is a way to split on the results of a split command as a one liner.
For example, I have swift tags formatted like the one below and I want to ultimately stuff the values separated by whitespace (ISIN and DE000GH2MY35) into my aref variable.
:35B:ISIN DE000GH2MY35
$aref = [split(split /:/, $_) [1]];I thought the above line would do it, but it's not working. I thought the interior split would give me the values (ISIN DE000GH2MY35) and then the outer split just splits on whitespace by default so i'd end up with $aref->[0] evaluating to 'ISIN' and $aref->1 evaluating to 'DE000GH2MY35', but i'm getting a syntax error.
Any help would be greatly appreciated.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: split on split?
by LanX (Saint) on Feb 01, 2022 at 19:22 UTC | |
by dirtdog (Monk) on Feb 01, 2022 at 19:29 UTC |