Tja, sunawa, ich kann auch nix erkennen.
Aber nach der Zeile
($x_wert, $y_wert, $id_wert) = imgsize($img_name);
würde ich einfügen:
die 'Image::Size Error ' . $id_wert
    unless defined $x_wert;
Denn (RTFM;) es steht geschrieben:
imgsize(stream)
Returns a three-item list of the X and Y dimensions (width and height, in that order)
and image type of stream. Errors are noted by undefined (undef) values for the first
two elements, and an error string in the third. The third element can be (and usually is)
ignored, but is useful when sizing data whose type is unknown.
... uns außerdem ... wer sagt Dir, daß nach
 $img_name = &read_data;
wirklich ein gültiger Name in $img_name steht?
Wie wäre es also mit:
die "cannot read image file $img_name"
    unless -r $img_name;
.. und das ganze dann noch ergänzt um:
die "empty $img_name"
    unless length($img_name);
Das ganze nennt sich dann defensive Programmierung.
.. und weniger Gottvertrauen, daß überall etwas Sinnvolles
drin steht - don't trust anybody .. especially not yourself.
Ob's Dein konkretes Problem löst weiß ich nicht,
aber ich kann mir gut vorstellen, daß Du dadurch
ein paar wertvolle Hinweise erhälst ;)
Was steht eigentlich in $suchname?
Grüße
   K@rl