Slash Boxes
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 ]

Saturday May 22, 2004
06:13 AM

brian is a big, fat dumbass

[ #18881 ]

Can you spot why this code does not do anything? Well, it took me 15 minutes, anyway. It was 6 am, but that does not really excuse anything.

if( undef $value )                { null_style()      }
elsif( $value eq NONE )           { null_style()      }
elsif( $value eq DEFAULT )        { default_style()   }
elsif( $value eq SURPRISE_ME )    { surprise_me()     }
elsif( $value =~ m/^LOCAL:(.*)/ ) { local_style( $1 ) }
elsif( $value =~ m/^URL:(.*)/   ) { redirect( $1 )    }

Before everyone decides to tell me what is wrong, I really do know how to test if a variable is defined. I just have this new keyboard that I am getting use to.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • of my most common mistake. It takes this form:
    if ($a = 0){
      # do something
    The other biggie for me is using == when I should have used 'eq'... for some reason I can read it a dozen times and not notice the problem.

    Maybe a few more years will help...
  • I just have this new keyboard that I am getting use to
    He he he... Funny :-)
    I think I'll use it in a new sig:
    This is my sig. It's not much since I just have this new keyboard that I am getting use to ... :)
    BTW, why weren't you running under "-w"? That would have immidiatly caused perl to shout "Use of uninitialized value in string eq ...", which is quite a strong hint at what's wrong :-)

    Offer Kaye