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

Tyring to find out quickly if Perl 5.6 would have a problem with a 4.14 gig file ? Thanks Alan

Replies are listed 'Best First'.
Re: Perl File Size Limit
by broquaint (Abbot) on Jun 04, 2003 at 14:06 UTC
    If you built perl with -DUSE_LARGEFILE and your operating system can deal with files of that size then perl should be able to deal with it.
    HTH

    _________
    broquaint

      If you built perl with -DUSE_LARGEFILE and your operating system can deal with files of that size then perl should be able to deal with it.

      To easily check if Perl was compiled with large file support, use perl -V (note: that's uppercase V) and see if it contains "uselargefiles=define". Or use the Config module. ($Config{uselargefiles})

      Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }

Re: Perl File Size Limit
by halley (Prior) on Jun 04, 2003 at 14:05 UTC

    File size limitations are almost always an operating system limit, or at least a filesystem limit, and not a limit of "application" level systems like Perl.

    On top of that, filesystems often allow files larger than what can be seeked (with standard runtime library calls), so it depends on how you're using it. A trivial program may only be able to randomly access the first 2GB of a file, while a streaming application (such as tar, gpg or a video player) can build and read many gigabytes sequentially.

    What operating system, what filesystem, and how are you dealing with the file?

    --
    [ e d @ h a l l e y . c c ]

Re: Perl File Size Limit
by EvdB (Deacon) on Jun 04, 2003 at 14:08 UTC
    Try this bit of code at the command line:
    perl -e 'open IN, $ARGV[0]; while (<IN>) { $size += length } print "Si +ze is: $size\n\n";' Your_file_name_here
    If size is the size then yes(ish). You did want a quick answer...

    Update: This code is shocking - please back up your file, your system, check your insurance and apply for a new passport before running it. Size may well not be size either - so don't trust that. If it completes without crashing though the answer may be yes.

    --tidiness is the memory loss of environmental mnemonics