develooper Front page | perl.beginners | Postings from February 2009

Exception Handling in perl

Thread Next
Sarsamkar, Paryushan
February 27, 2009 05:42
Exception Handling in perl
Message ID:
Hi All,


Can we handle exceptions in PERL programs?


For example - Here if it fails to copy then can I handle the exception
and perform the next steps in my script? I tried removing "die" but then
it does not complain and I wont be able to come to know if that is
copied or not. (Is there anything similar to try and catch as in JAVA?) 




use strict;

use warnings;

use File::Copy;


copy ("C:\\build.xml","D:\\build.xml") or die "Cannot copy : $!";


#next things to do







Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About