or download this
#!/usr/bin/perl
use strict;
...
$file =~ s/ *["']?([^"']*)["']? *$/$1/; # strip whitespace and
+quotes
if (-e "$file") {print "\nFile found, everything is fine.\nFile:>$file
+<"} else {print "\nOoops, file not found.\nFile: >$file<"}
<STDIN>;