Hi, I have a perl which executes multiple UNIX command (using the system f +unction). Incase of any error in any one of the statements , I need to stop the +execution there and capture the actual error thrown. I tried using eval with $@ , but it didnt work. This is what i tried: --------------------------------------------------------- eval { system("cp xyz.dat abc.dat"); system("cp xyz.dat2 abc.dat2"); }; if ($?) { print "Error occured :".$@; print "\n"; } ~ --------------------------------------------------------- And the output is: % perl temp.perl cp: cannot access xyz.dat cp: cannot access xyz.dat2 Error occured : --------------------------------------------------------- I want the control to come out when the first copy failed.And also wan +t to cupture and log the actual error message. Can some one tell how to achive this. Thank you, Pradeep
In reply to Perl exception - multiple statement by pradeepbstays
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |