Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: -e " " returns true

by davorg (Chancellor)
on Jul 05, 2004 at 15:50 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://371910]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (2)
As of 2024-04-26 07:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found