in reply to Re: Add hash to DB_HASH file using DB_File
in thread Add hash to DB_HASH file using DB_File

I probably overuse them a bit but if there is the smallest doubt I bracket my functions. Looking at that little knot reminds me why its a good idea :)

--
my $chainsaw = 'Perl';

  • Comment on Re: Re: Add hash to DB_HASH file using DB_File

Replies are listed 'Best First'.
Re: Re: Re: Add hash to DB_HASH file using DB_File
by dws (Chancellor) on Apr 09, 2001 at 20:20 UTC
    Bracketing your functions isn't quite the lesson I would expect you to draw from this, though it works. More flexible, in my opinion at least, is to use   somesub arg1, arg2, arg3 or die "message"; instead of   somesub arg1, arg2, arg3 || die "message"; which is really  somesub arg1, arg2, (arg3 || die "message");
      I use the parentheses.

      That is more friendly to someone who doesn't know the precedence tables by heart, and it also plays better with strict.

      As I like to say, if your code doesn't yet look like Lisp, then another pair of parentheses probably won't hurt...

        The danger of adopting an "oh, another set of parenthesis won't hurt" attitude with Perl is that you'll nail yourself by introducing a list (or list context) when you don't intend to.

        Worse, people who aren't at your level of skill will carry on the practice through "Cargo cult" programming, and will trip all over themselves.