in reply to Re^5: Control Structures
in thread Control Structures

I understand how the problem manifests itself, it's not rocket science after all.

What I am saying is that if I want this:

sub foo { my $arg = shift; my $object = ($arg) ? Some::Package->new() : Other::Package->new(); }
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.

Replies are listed 'Best First'.
Re^7: Control Structures
by perrin (Chancellor) on May 12, 2005 at 05:37 UTC
    "Blindingly obvious"? Your change looks like a tiny style nudge, not the difference between working and broken. It doesn't surprise me at all that people trip on this.