in reply to Sort VCards by Surname

print map { $_->[1],"\n" } sort { $a->[0] cmp $b->[0] } map { [ /\bN:( +\w+)/, $_ ] } <>;
I'm worried about what will happen when the match doesn't match.

And speaking with some granted authority on the construct that bears my name (but I didn't name it myself), the canonical Schwartzian Transform always puts the original item in slot 0 of the tuple (which would at least still attempt to do the right thing if the match failed here):

print map { $_->[0],"\n" } sort { $a->[1] cmp $b->[1] } map { [ $_, /\ +bN:(\w+)/] } <>;

I've now described the ST three times for publication: a very early column, Joseph's Effective Perl Programming book, and now my new Learning Perl Objects, References and Modules.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.