Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re^2: -e stransgeosities

by misterperl (Beadle)
on Apr 23, 2012 at 13:44 UTC ( #966599=note: print w/replies, xml ) Need Help??

in reply to Re: -e stransgeosities
in thread -e stransgeosities

thanks for the replies. I tried it with both relative and absolute paths- same result. And As I said, I cut and pasted the directories from the debugger and *ls'ed* them and they are fine ;so there appears to be no oddball characters.

I should have been more accurate and said I was looking for duplicate file NAMES, not contents. I don't really care what's in them. 

Basically the questions are 

(a) why does -e valid_file_path return undef, and 

(b) why does (defined $a && $a) return TRUE when $a eq undef?

Replies are listed 'Best First'.
Re^3: -e stransgeosities
by Corion (Pope) on Apr 23, 2012 at 13:49 UTC

    Please, instead of showing excerpts from debugger sessions together with some narrative, write and show a short program that replicates the steps you did. This makes it far more clear what you did and what results you get.

    A rough start could be:

    #!perl -w use strict; my $d1 = '/this/file'; my $d2 = '/that/file'; for ($d1, $d2) { print "[$_] " . (-e $_ ? "exists" : "does not exist") . "\n"; }; if (...) { ... }; # Show the contents of the directories in question system("find /this /that");
Re^3: -e stransgeosities
by Jenda (Abbot) on Apr 23, 2012 at 23:33 UTC

    Ad a) Because the file path is not valid. I bet there is some whitespace character in the variable.

    Ad b) So $a is not undef, it just eq undef. Waitasecond ... an empty string is defined, yet equals to undef. Or maybe I should say undef gets turned into an empty string in a string context?

    Enoch was right!
    Enjoy the last years of Rome.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://966599]
[Tux]: when I set QT_IM_MODULE and GTK_IM_MODULE both to c<xim> and *unset* XMODIFIERS, all works fantastic
Tux => $HOME
[Tanktalus]: great, now I'm going to have to convert html codes to text for display... :)

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (12)
As of 2017-09-25 21:16 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (291 votes). Check out past polls.