my $snapshot = new Image::Grab; $snapshot->ua->timeout(5); # define the timeout for grabbing an image. Default is 180 sec$ $snapshot-> url( "IPCamera{$key}"); #define the source of the image $snapshot->grab; #grab an image mark_blob(my $pic); $pic = $snapshot->image; #debug my $SaveFile = join("","$ImagePath{$key}",×tamp,"\-snapshot\-$key.jpg"); print ("Save filename: $SaveFile"); open(my $fh, ">$SaveFile") || die "$SaveFile: $!"; binmode $fh; # for MSDOS derivations. print $fh $pic; close $fh; #### DB<1> c 42 main::(grab-images.pl:42): mark_blob(my $pic); DB<2> n main::(grab-images.pl:43): $pic = $snapshot->image; #debug DB<2> main::(grab-images.pl:45): my $SaveFile = join("","$ImagePath{$key}",×tamp,"\-snapshot\-$key.jpg"); DB<2> main::(grab-images.pl:46): print ("Save filename: $SaveFile"); DB<2> main::(grab-images.pl:48): open(my $fh, ">$SaveFile") || die "$SaveFile: $!"; DB<2> Save filename: /var/images/trackcam1/2017-04-23_20:40:01-snapshot-1.jpg main::(grab-images.pl:49): binmode $fh; # for MSDOS derivations. DB<2> main::(grab-images.pl:50): print $fh $pic; DB<2> s Use of uninitialized value $pic in print at grab-images.pl line 50. at grab-images.pl line 50. main::(grab-images.pl:51): close $fh;