You should really be reading p5p. There are some absolute gems there. For a bit, there's been a debate about the behavior of sort in scalar context. Since the behavior is undefined, merlyn wrote: 'The other strawman I use is "sort in a scalar context might just play Nethack". Can you implement that instead?' So Paul Fenwick did.
--- pp_sort.c.orig Thu Jun 24 13:35:06 2004 +++ pp_sort.c Thu Jun 24 13:47:37 2004 @@ -1426,7 +1426,15 @@ I32 is_xsub = 0; I32 sorting_av = 0; + /* If we're called in a void context, then play Nethack. + * Suggested by Randal in <86ekonz92m.fsf@blue.stonehenge.com> + * p5p, 11th June 2006. + * + * BUG: This fails if nethack is not in the current path. + */ + if (gimme != G_ARRAY) { + system("nethack"); SP = MARK; RETPUSHUNDEF; }
What's really fascinating about this patch is that Randal isn't going to make this suggestion for another two years :)