http://www.perlmonks.org?node_id=62675


in reply to Key Word In Context system (golf, anyone)?

I believe this'll do it in 60 bytes:

print sort map{sub{map{push@_,shift;"@_\n"}@_}->(split)}<>

update: Yup, I can't count ... 58 characters showing (59 bytes if we include a terminal newline in our file).