Could be due to a bug in Image::Size or in your code. Is imgsize() always returning three values? If not, only $width and $height are set by the assignment, and $error remains unchanged if there was no error. Try setting $error explicitely to '' before calling imgsize().