Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
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


Comment on Re: -e " " returns true
Download Code
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
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)}

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://371910]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (8)
As of 2014-09-01 08:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (299 votes), past polls