You need that (...)[0] for the match to return the captures in list context, ( <=> is enforcing scalar context and m// only returns captures in list context otherwise boolean )
I'm wondering if there is a prettier solution for that.
The Schwartzian transform doesn't have that limitation.
... map { [$_, /(\d+),/] } @list;
should do already.
clarification: any better solution than (...)[0] to get list context ?
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
In reply to Re^2: How can I sort my array numerically on part of the string? (updated)
by LanX
in thread How can I sort my array numerically on part of the string?
by misterperl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |