http://qs321.pair.com?node_id=371910


in reply to -e " " returns true

That's not what I'm seeing.

$ cat test.pl #!/usr/bin/perl use strict; use warnings; my @files = (' ', ' . . ', ' .. ', ' ', ' . '); foreach (@files) { print "[$_] - ", -e $_ ? "yes\n" : "no\n"; } $ ./test.pl [ ] - no [ . . ] - no [ .. ] - no [ ] - no [ . ] - no $ perl -v This is perl, v5.8.3 built for i386-linux-thread-multi
--
<http://www.dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg

Replies are listed 'Best First'.
Re^2: -e " " returns true
by crazyinsomniac (Prior) on Jul 05, 2004 at 16:00 UTC
      This is one of the times I really wish I was still on Linux.
      Thanks for trying as well and all those fast replies.

      Hans
        Hey PerlingTheUK,

        Here's a quick fix for you until you get around this problem. It produces correct results for those dotty filenames both under Windows XP (5.6.1 active perl) and Linux (RedHat 9, 5.6.1 as well).
        my $f = ". ."; my $result = minuse ($f); print "[$result]\n"; sub minuse { -f $_[0] || &minusd} sub minusd {local *D; opendir (D, shift) && (close (D) || 1)}
Re^2: -e " " returns true
by simonm (Vicar) on Jul 05, 2004 at 15:56 UTC
    Same all-negative results here: This is perl, v5.6.0 built for darwin.

    Can we get a Windows ActivePerl user to run this as well?

      Using davorg's script I had 5 yes's.
      I have the same setup as PerlingTheUK.
      wfsp