Nov 27, 2006 #1 shlomyb Programmer Nov 14, 2006 32 IL Hi Here is the code : eval {$a = $parser->parsefile("$OLD_CONF_DIR$file");}; & {&LOG("ERROR","Erorr ...");print $@; exit(1); } if $@; My question is not related to the eval command but to the "&" after it.... what does it mean ?
Hi Here is the code : eval {$a = $parser->parsefile("$OLD_CONF_DIR$file");}; & {&LOG("ERROR","Erorr ...");print $@; exit(1); } if $@; My question is not related to the eval command but to the "&" after it.... what does it mean ?
Nov 27, 2006 #2 Kirsle Programmer Jan 21, 2006 1,179 US It seems to be calling an anonymous subroutine. It would be equivalent to this: Code: sub on_error { &LOG ("ERROR, "Error..."); print $@; exit(1); } &on_error if $@; ------------- Kirsle.net | Kirsle's Programs and Projects Upvote 0 Downvote
It seems to be calling an anonymous subroutine. It would be equivalent to this: Code: sub on_error { &LOG ("ERROR, "Error..."); print $@; exit(1); } &on_error if $@; ------------- Kirsle.net | Kirsle's Programs and Projects
Nov 27, 2006 #3 KevinADC Technical User Jan 21, 2005 5,070 US also same as: Code: eval {$a = $parser->parsefile("$OLD_CONF_DIR$file");}; if ($@) { &LOG("ERROR","Error: $@"); print $@; exit(1); } - Kevin, perl coder unexceptional! Upvote 0 Downvote
also same as: Code: eval {$a = $parser->parsefile("$OLD_CONF_DIR$file");}; if ($@) { &LOG("ERROR","Error: $@"); print $@; exit(1); } - Kevin, perl coder unexceptional!