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

Last night I was dreaming about the project I'm working on. so what? standard stuff. The project is all perl. No big deal, this is a perl site ...

But here's the really worrying bit: I woke up because part of my brain said "That code will never work. You need to ..." and then the debugging process woke up within me and my full consciousness returned pondering map{} and regexes and then I couldn't go back to sleep.

You know you're in for trouble when you start wondering whether

for (my $i=1; $i<=10000; $i++) { my $s = Sheep->new($i); $gate->through($s); }
would be more efficient written using an array like this:
my @herd; for (1..10000) { push @herd(Sheep->new($_)); } $gate->through(\@herd);
and then worrying whether you'd do even better to one line the whole thing
$gate->through(Sheep->new($_)) for (1..10000);
and then you wonder whether you couldn't fork() cunningly so that part of you is running Sheep->new($_) while another part is doing the gate->through($previous_sheep) bit. And then you wake up screaming because you still haven't figured out how to get windows to fork properly...

And we try again

$me =~ s!wide awake!fast asleep!g;
no hang on maybe I need to use the /e modifier.
$me =~ s!wide awake!asleep(fast)!ge;
no no no that'll never work I need quotes
$me =~ s!wide awake!asleep('fast')!ge;
ANd maybe I'm not wide awake so how about
$me =~ s!(wide )?awake!asleep('fast')!ge;
or better
$me =~ s!(?:wide\s+)?awake!asleep('fast')!ge;
ZZzzzzzzzzzz...................

Dingus


Enter any 47-digit prime number to continue.