use strict; use warnings; use Cwd qw(abs_path); my $file = $ARGV[0] || "."; die "Error - couldn't find (or read) '$file': $!\n" if !(-e $file); print abs_path($file) , "\n";