in reply to Re^2: Style Question: Throwaway Objects
in thread Style Question: Throwaway Objects

Interestingly it has been pointed out to me that for() can be used as a with, but it doesnt quite do it for me...
for ($some->{complex}[$object]{that}{we}[$need]{to}[$use]) { $_->foo; $_->bar; }
And a proper with construct allows the compiler opportunities to optimize far beyond what any other solution allows as it explicitly states that the object will be immutable for the duration of the with. *sigh*

:-)

--- demerphq
my friends call me, usually because I'm late....

Replies are listed 'Best First'.
Re^4: Style Question: Throwaway Objects
by Aristotle (Chancellor) on Dec 09, 2002 at 18:51 UTC
    You do save all the duplicate lookup work in this case, if that's what you mean. Anyway, the Perl compiler is pretty simpleminded as far as optimization goes, so performance is hardly an argument for having a with construct at this point.

    Makeshifts last the longest.