Monknom has asked for the wisdom of the Perl Monks concerning the following question:

Sorry for the trouble - I figured out the problem - the homedir and the dirs had a folder in between them... now, how do I delete a post...?

Wise Monks,

I bought a new computer, with Win7 Home Premium installed and then installed the latest ActiveState Perl. Now I'm trying to run a script that used to work on my WinXP box (with an older version of Perl).

It appears that my file existence check (-e) is failing, even though the files exist. Please help!

Searching for answers, I tried setting perl.exe as "Run as administrator" - still fails. I can't seem to locate anything here or on google. Does anyone here have any ideas?

ActiveState x64 v5.14.2.1402

# @dirs = array of child directories # $homedir = root directory where @dirs branches from # $sourcefile = name of the file we're looking for in each directory foreach my $dir (@dirs) { if (!-e "$homedir/$dir/$sourcefile") { print "file is missing: $homedir/$dir/$sourcefile\n"; } }

What I get is a bunch of "file is missing" errors even though when I look at the locations, the required files are there.

Replies are listed 'Best First'.
Re: -e check fails on existing files in Win7 - please help
by MidLifeXis (Monsignor) on Feb 08, 2012 at 13:18 UTC

    Posts do not get deleted (known as reaping) from PM but for exceptional reasons (duplicate post, blatant trolling, spam, and things of that nature). Even then, it is not truly deleted, but only marked as reaped, and viewable by those with the proper user settings.

    PM uses the theory that my learning process can help someone else as well, so things don't get deleted. A user blanking out their post even generates a request of the janitors for a content restore.

    Welcome to the monastery.

    --MidLifeXis

Re: -e check fails on existing files in Win7 - please help
by ikegami (Patriarch) on Feb 09, 2012 at 04:15 UTC

    [ For future reference ]

    What error is -e returning? (Check $!)

    Make sure you are checking the path you mean to check.

    use Data::Dumper; local $Data::Dumper::Useqq = 1; print(Dumper("$homedir/$dir/$sourcefile"));
Re: -e check fails on existing files in Win7 - please help
by locked_user sundialsvc4 (Abbot) on Feb 08, 2012 at 14:21 UTC

    Indeed... threads are a lasting resource and should be treated that way by OP’s and by subsequent contributors.   You might not have been the first person who had the misfortune of having encountered this problem, but, thanks to your informative posting, you might well be the last.   This is one of the reasons why it is a very good practice to, say, edit your original post to clearly say Solved (see my comment #x on xx/xx/xx), but otherwise to leave the content exactly as you originally wrote it.   Then, add a separate follow-up reply to the thread, which details the solution in sufficient detail that a knowledgeable stranger can follow in your steps.

    In this way, when I or anyone (perhaps many years later...) search for the post, I can find both an original panicked description of the problem (yeah! that’s me!!   this post is going to help me!), then I can find the solution.   If there was debate or discussion or clarification that lead up to that solution, I have access to that information, as well.

    Aside from its value as a brief interlude between the morning coffee-pot and the start of the work day, this is where PerlMonks really shines:   as an informational resource of many years’ running.