#!/usr/bin/perl -w use strict; use Cwd 'abs_path'; defined @ARGV and print sameDirectory(@ARGV),$/; sub sameDirectory { (-d) ? $_ = abs_path $_ : return -1 for @_; $_[0] ne $_ and return 0 for @_; 1; }