in reply to Re^5: Control Structures
in thread Control Structures
What I am saying is that if I want this:
It seems blindingly obvious that the snippet you provided is not the way to go about it. I agree that the compiler should warn you about this (or better yet, disallow it entirely); it just seems that if someone has trouble with this, the problem probably lies with understanding 'my', not confusing if() syntax.sub foo { my $arg = shift; my $object = ($arg) ? Some::Package->new() : Other::Package->new(); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: Control Structures
by perrin (Chancellor) on May 12, 2005 at 05:37 UTC |