use strict; use warnings; my $test = "test eins"; eval { substr($test,1 ,2 , "xx"); }; print $@ if $@; print "Hallo";