in reply to Re^6: Renaming an image file
in thread Renaming an image file

This is wrong: $filename =s[_(\d+).jpg$][_$md5.jpg];

You mean =~, not =. That fixes the error mentioning $_ (s/// works on $_ by default).

Also, the Perlish way to loop over an interval like that is for my $i (0..3) {.