juliosergio has asked for the wisdom of the Perl Monks concerning the following question:
I'm new here, and in Perl as well. I thought I'd learnt that
if (1) { statement; }
is more or less the same as:
statement if (1);
However, I'm puzzled with the following, that uses the compound statement and doesn't work
{print "one\n"; print "two\n";} if (1);
Do you have any comments on this?
Thanks! -Sergio.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: "if" and compound statement
by BrowserUk (Patriarch) on Feb 13, 2012 at 16:13 UTC | |
by juliosergio (Sexton) on Feb 13, 2012 at 16:48 UTC | |
by JavaFan (Canon) on Feb 13, 2012 at 17:10 UTC | |
by BrowserUk (Patriarch) on Feb 13, 2012 at 17:36 UTC | |
Re: "if" and compound statement
by choroba (Cardinal) on Feb 13, 2012 at 16:05 UTC | |
Re: "if" and compound statement
by educated_foo (Vicar) on Feb 13, 2012 at 16:07 UTC | |
Re: "if" and compound statement
by tobyink (Canon) on Feb 13, 2012 at 22:14 UTC | |
Re: "if" and compound statement
by GrandFather (Saint) on Feb 13, 2012 at 23:33 UTC | |
by JavaFan (Canon) on Feb 14, 2012 at 14:14 UTC | |
by GrandFather (Saint) on Feb 14, 2012 at 19:24 UTC | |
by JavaFan (Canon) on Feb 14, 2012 at 23:20 UTC | |
by Anonymous Monk on Feb 15, 2012 at 12:08 UTC | |
Re: "if" and compound statement
by ikegami (Patriarch) on Feb 14, 2012 at 06:06 UTC |
Back to
Seekers of Perl Wisdom