in reply to Re^2: Condensing a grep into a sort
in thread Condensing a grep into a sort
I was wondering really, if it was possible to have a regular expression return 'null', in list context,
Yes, a regular expression will return 'null' in list context:
$ perl -le' use Data::Dumper; for ( "C123xyz", "Cklm" ) { push @data, /C(\d*)/, "MARKER"; } print Dumper \@data; ' $VAR1 = [ '123', 'MARKER', '', 'MARKER' ];
and to have sort somehow not add the null to the sorted list.
sort does not provide a way to change the size of the list it operates on, so no.
|
|---|