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

Hello Fratres, I got following phenomenon:
$ ls -ltr -rw------- 1 pelagic dba 4294967296 Mar 16 13:50 foo -rw------- 1 pelagic dba 4096 Mar 16 13:52 bar

a big and a small file.
I then execute the following:
use strict; my @files = qw/foo bar/; foreach my $file (@files) { if (-e "$file") { print $file, " found\n"; } else { print $file, " not found\n"; } }

and get the printout:
foo not found bar found
The File Test Operators seems to "overview" my biggie ...
any suggestions why this could be happening?
(This is perl, version 5.005_03 built for sun4-solaris)
pelagic

-------------------------------------
I can resist anything but temptation.

Replies are listed 'Best First'.
Re: File Test Operator '-e' with large files
by Limbic~Region (Chancellor) on Mar 16, 2004 at 13:27 UTC
    pelagic,
    This is just a hunch, but was your perl compiled for large file support?
    $ perl -V Compile-time options: MULTIPLICITY USE_ITHREADS USE_64_BIT_INT USE_LAR +GE_FILES PERL_IMPLICIT_CONTEXT
    I am going to go check perldelta now to verify your version supports large files even though it would require recompiling.

    Cheers - L~R

    Update: Large file support became available in 5.6.0. You may have to resort to letting the OS handle it for you.

Re: File Test Operator '-e' with large files
by calin (Deacon) on Mar 16, 2004 at 13:35 UTC

    I know that stat(2) fails on large files on some systems ; programs have to use stat64 or similar.

    Here's a checklist:

    • Is Perl compiled with large file support?
    • Is your system modern enough (ls seems to work...)
    • Are you sure you're in the right directory?

Re: File Test Operator '-e' with large files
by pelagic (Priest) on Mar 16, 2004 at 13:52 UTC
    Thanks for all hints.
    stat failes indeed on our system and perl's -e seems to use stat ... so I will have to look for a other solution.
    pelagic

    -------------------------------------
    I can resist anything but temptation.