Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

TryCatch: Simple Try Catch Block In Perl

DZone's Guide to

TryCatch: Simple Try Catch Block In Perl

·
Free Resource

### begin_: file metadata
    ### 
  
   
    ### main:
    ###   - name    : TryCatch: try catch block
    ###     desc    : a simple try-catch block example in perl
    ###     date    : created="Thu 2005-12-01 10:58:09"
    ###     last    : lastmod="Thu 2005-12-01 10:58:13"
    ###     tags    : try catch finally error perl cfTryCatch exception
    ### 
  

### begin_: init perl
    use strict;
    use warnings;

### begin_: try-catch block
    print "begin \n";
    eval{
        ### try block
        print Non_Existent_Function();
    };
    if ($@){
        ### catch block
        print "Failed \n";
    };
    print "end \n";
Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}