use strict; use warnings; use GD; my $image; # $image = GD::Image->new($data) # If something goes wrong, this call will return undef. # so one could do : ($image = GD::Image->new("test.jpg")) or warn "Error: $!"; # or if (! ($image = GD::Image->new("test.jpg")) ) { print "my error handling\n"; } # eval trapping would work too...