in reply to Re: Does eval cause that much of a performance hit?
in thread Does eval cause that much of a performance hit?
What are the alternatives:
my $foo; if( $baz ) { $foo = $bar; }
Or
my $foo; $foo = $bar if $baz;
Of course, if you're setting $foo, then presumably your gonna use it at some point later. And unless your enamoured with testing every variable for undef prior to using it, then in most cases there is a sensible default that it can be initialised to. In which case:
my $foo = 0; $foo = $bar if $baz;
Of course, that can be done "long hand" also if that's you preference.
And that's the point. Using this particular flaw in the Perl semantics as a justifiction for a style preference is disingenuous.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Does eval cause that much of a performance hit?
by grinder (Bishop) on May 06, 2009 at 13:38 UTC | |
by BrowserUk (Patriarch) on May 06, 2009 at 13:50 UTC | |
by grinder (Bishop) on May 06, 2009 at 15:02 UTC | |
|
Re^3: Does eval cause that much of a performance hit?
by perrin (Chancellor) on May 06, 2009 at 20:03 UTC | |
by BrowserUk (Patriarch) on May 06, 2009 at 20:22 UTC |