Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Ovid (2709)

Ovid
  (email not shown publicly)
http://publius-ovidius.livejournal.com/
AOL IM: ovidperl (Add Buddy, Send Message)

Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.

Journal of Ovid (2709)

Thursday June 24, 2004
10:47 AM

sort() in scalar context

[ #19468 ]

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 :)

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.