http://qs321.pair.com?node_id=11124499


in reply to Re^2: How can I sort my array numerically on part of the string? (updated)
in thread How can I sort my array numerically on part of the string?

Here's a capture in list context. Prettier?

#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11124461 use warnings; my @list = ( '1,cat', '2,dog', '22,mouse', '11,eel', '001,elk', '13,mi +nk'); my @n; @n[ /(\d+),/ ] .= "$_\n" for @list; print grep defined, @n;

This is why perl is fun :)