in reply to Re: Test to see if directories are the same
in thread Test to see if directories are the same

Or, a bit more obscure but very cool:
sub same_file_p { my @stat1 = stat shift; my @stat2 = stat shift; return "@stat1[0,1]" eq "@stat2[0,1]"; }
And even weirder:
sub all_same_file { # true if all arguments represent the same file my %counts; $counts{join " ", (stat)[0,1]}++ for @_; 1 == keys %counts; }

-- Randal L. Schwartz, Perl hacker

Replies are listed 'Best First'.
Re (tilly) 3: Test to see if directories are the same
by tilly (Archbishop) on Jan 18, 2001 at 00:11 UTC
    Inode numbers are not reported on Windows so the above is OS-specific, as is this version:
    sub all_same_file { my @desc = map {my @s = stat; "@s[0,1]"} @_; @_ == grep {$desc[0] eq $_} @desc; }
Re: Re: Re: Test to see if directories are the same
by danger (Priest) on Jan 18, 2001 at 00:26 UTC

    And slightly weirder:

    sub all_same_file { join(" ",map{(stat)[0,1]}@_) =~ /^(\d+ \d+) (\1 ?){$#_}$/; }