Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: -e " " returns true

by davorg (Chancellor)
on Jul 05, 2004 at 15:50 UTC ( #371910=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://371910]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (10)
As of 2016-12-05 19:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (91 votes). Check out past polls.