Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Increasing buffer size(?) for input FileHandle

by basicdez (Pilgrim)
on Oct 17, 2002 at 20:18 UTC ( #206125=perlquestion: print w/replies, xml ) Need Help??

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

Please help me with your infinite wisdom. I am pulling in a .dat file as an input file to my perl module usinf the following:

my $fname = "$datpath2/pd2x.dat2";

I am accessing the contents via:

open FH, "< $fname" or die "Cannot open datfile: ", $!; while (<FH>) { if (/"DESTINATION"/) { . . .

Whenever I get an input file greater than 45,000+ bytes my perl module comes to a stand still. Anything less than this and it runs just fine. What do I need to do to be able to input a larger file.

I apologize for being a novice

peace, LOVE and ((code))

Edited: ~Fri Oct 18 21:32:21 2002 (GMT) by footpad: Added <code> tags and other HTML formatting to improve legibility, per Consideration

Replies are listed 'Best First'.
Re: Increasing buffer size(?) for input FileHandle
by Aristotle (Chancellor) on Oct 18, 2002 at 14:08 UTC
    Perl imposes are no limits on any variables other than the available memory. Try adding a few prints in there, right after you read a line, before you call the function, after, and so on. I suspect it is the function you call that for some reason chokes on input larger than 44k; by adding prints you'll be able to verify at which point in time exactly things go awry.

    Makeshifts last the longest.

Re: Increasing buffer size(?) for input FileHandle
by janx (Monk) on Oct 17, 2002 at 20:55 UTC
    Just a few thoughts:
    1. Are there any line breaks in that file?
      The "<FH>" will read in one complete line - though I don't think your system should have a problem with a 45000 byte line.
    2. What exactly do you mean by standstill? Can you take a look at exactly how much memory your program consumes?
    3. Are possibly running into an infinite loop somewhere? It might be embarrassing, but know ;-)


      by standstill I mean that the code just stops working and goes back to the previous input buffer to send a message back to the area I am attempting to interface with.

      with the open FH command, isn't there some way that I can reset the buffer size to something larger?

      peace, LOVE and ((code)) basicdez

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://206125]
Approved by footpad
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (7)
As of 2022-05-26 22:55 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (94 votes). Check out past polls.