use Data::Dumper; #using the Dumper function to get the internal structure use Error qw(:try); #specifying to going to use the try block.This is enough to use all the # things in it try { #defining a try block my @array; #declaring an array throw Error::Simple "Oops!Array is Empty." unless(@array); #throwing the exception if the array is an empty } catch Error::Simple with { #catching the error my $error=shift; #getting the Error hash print Dumper $error; #printing it in dumper function to know all the details such as filename,line number,the error message,package informations,etc., } except { #defining an except block print "Exception Block\n"; } otherwise { #defining an otherwise block print "Otherwise Block\n"; }