in reply to Re: Possible looping or syntax error
in thread Possible looping or syntax error

It's true that the more code, the more potential bugs, but that technique removes perl's ability to warn about variable name typos, unless you're using a locked hash. Better to stick with first-class lexicals in this case.

  • Comment on Re: Re: Possible looping or syntax error

Replies are listed 'Best First'.
Re3: Possible looping or syntax error
by dragonchild (Archbishop) on Dec 24, 2003 at 13:51 UTC
    Also true. This is why I personally use the following variation:
    my $useful_object = Useful::Class->new; $useful_object->$_($cgi->param($_)) for qw( param1 param2 param3 );

    I get the benefits of hash naming with the benefits of Perl's watchful eye. (Albeit, at runtime and not compiletime, but a decent compromise, imho.)

    ------
    We are the carpenters and bricklayers of the Information Age.

    Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.