in reply to dereferencing problem

Once suggestion from me... drop that subroutine like a hot potato and use Image::Info for retreiving the image information!

use Image::Info qw(dim); my $MyFileName = "$ClassPath/classimg/$UpLoadedImg"; my ($width, $height); if (-e $MyFileName){ my $info = image_info($MyFileName); ($width, $height) = dim($info); ...