in reply to File path

use Cwd 'abs_path'; my $path = abs_path($file);

(Update: though, reading the other replies, I may have misunderstood the question...)