in reply to "if" and compound statement

Not just "doesn't work" - it's a syntax error which should suggest to you that the animal you have by the tail is not the one you thought you had.

As a general thing we often suggest to newbies to always use strictures (use strict; use warnings;), but in this case it fails without needing them - however the advice is still good!

True laziness is hard work

Replies are listed 'Best First'.
Re^2: "if" and compound statement
by JavaFan (Canon) on Feb 14, 2012 at 14:14 UTC
    As a general thing, it's often recommended to eat a serving of vegetables, and two pieces of fruit everyday. The OP's code would have failed regardless how much veggies and fruit he has consumed, however, the advice is still good!

      Sure, and if the OP had said he was a six year old Perl newbie I might have offered other good life advice too. But this is a Perl oriented site and the OP gave no such indication so I didn't. Strictures, strict in particular, are such useful tools for catching typos and other errors, that suggesting their use to self avowed Perl newbies is pretty much always good advice.

      True laziness is hard work
        But eating veggies is also always a good advice. This is a Perl programmer oriented site, and the OP did not give any indication he isn't a human, so it's a good thing for him to eat veggies. And fruit. Of course, it's utterly irrelevant for the problem he's asking about, but so are the strictures and warnings.

        Perhaps you ought to read: Why I left Perl