in reply to Unable to read a file

Also note that your my $dir =<>; is not quite the same as your my $dest_dir = <STDIN>;.

If you run your script without arguments it will read from STDIN, but if you supply arguments it will treat your arguments as filenames and read from them.

This may or may not be what you want (ususally it's a bug).