SPUG: Efficiency of Eval

Asim Jalis ajalis at beryllium.cobaltgroup.com
Mon Dec 6 16:38:54 CST 1999


Is:

  eval { some_function_which_calls_die_on_error ($a) ; <stuff> ; }
  if ($@) { <handle-exception> ; }

more efficient, or is:

  $r = some_function_which_returns_non_zero_on_error ($a) ; 
  if ($r != 0) { <handle-exception> }
  else         { <stuff> . . . <stuff> ; }

more efficient (in terms of speed). (Ignore code typos.)

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    POST TO: spug-list at pm.org        PROBLEMS: owner-spug-list at pm.org
 Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
 SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe
        Email to majordomo at pm.org: ACTION spug-list your_address





More information about the spug-list mailing list