in reply to Re: Check your wits
in thread Check your wits

"Obviously" the script is flawed, but the real question is did you see it before you ran the script or afterwards:-)

For the record: I did afterwards:-/ Gestalt Principles of Perception?

Replies are listed 'Best First'.
Re^3: Check your wits
by ikegami (Patriarch) on Aug 08, 2008 at 20:23 UTC

    Before. I took the approach of identifying difference with what I would do. I immediately saw two things: code before functions, and use of exit. I looked if there was more code below exit, and voila!

    The fix is to add one word:

    #!/usr/bin/perl use strict; use warnings; use Data::Dumper; _test(); exit; ######## subroutines BEGIN { <----- my @values = qw( 1 2 3 ); sub _test { print "Values:\n", Dumper( \@values ); } }
Re^3: Check your wits
by JavaFan (Canon) on Aug 08, 2008 at 15:11 UTC
    I saw it before I ran the script. But obviously, from how the question was framed, I knew in advance there was something fishy. And the shortness of the code didn't leave many options of what would be wrong.

    Would I have seen it if the program was larger, and it wasn't flagged as "there's something going on here"? Probably not.

Re^3: Check your wits
by jethro (Monsignor) on Aug 08, 2008 at 16:38 UTC
    I didn't see it because I was expecting some closure pitfall and was searching for that to the exclusion of everything else.