in reply to Passing user input to a shell command
Your problem, more likely than not, is that there's a newline character at the end of $file;
Try adding the line:
$file = <STDIN>; chomp $file;
Another piece of advice is to use $! when printing errors that result from system calls:
open(IN, $file) or die "The file $file is not present ($!)\n";
|
|---|