>>>>> "SB" == Steve Bertrand <st...@ibctech.ca> writes:

  SB> my $ret = ( $foo == 1 ) ? ( $num + $add_to ) : 2;

those aren't side effects. there is no change to data in the ?: parts.

  SB> ...SHOULD _always_ ( where possible ) be written as:

  SB> my $expr_result = ( $num + $add_to );

  SB> my $ret = ( $foo == 1 ) ? $expr_result : 2;

no, you can have full expressions in there. side effects means
assignment, and similar stuff. all expressions have values but some also
change things elsewhere which is what side effects are. 

uri

-- 
Uri Guttman  ------  u...@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to