Ask a Question related to PERL Miscellaneous, Design and Development.
-
J Krugman #1
Strange behavior after reading big file
I have a piece of code that looks something like this:
my %hash;
my $i = 0;
open HUGE, 'Huge_File' or die '>*choke*<';
$| = 1; print "\n";
for my $x (<HUGE>) {
chomp $x;
$hash{$x} = $i++ if some_test($x);
print "\rProcessed up to line $i " unless $i % 10000;
}
close HUGE;
print "Done reading Huge_File\n";
# ... do something with %hash
When I run this code, it dutifully reports processing the total
number of lines (to the nearest 10000), but it never prints "Done
reading ... ". As far as I can tell it just hangs. The code works
fine if the input file is of a "normal" size (1000 lines, say),
but I need to run it on a file that is 25 million lines long, and
it is in this case that I observe the hanging behavior I've just
described.
Any suggestions would be most welcome. FWIW the OS is Linux, and
I'm running Perl 5.6.1, and have 0.5G of RAM.
Thanks!
-Jill
Huge_File has about 25 million lines. The reporter statement
J Krugman Guest
-
strange behavior in File::Basename
I'm using Perl 5.6.1 on Debian Linux 3.0 I noticed the module File::Basename doesn't behave like the shell commands basename/dirname in a special... -
Strange behavior when saving a file
I'm using Illustrator 10.0.3, Mac OS 10.2.8. When I make changes to one of my Illustrator files and save it, it makes a copy of that file to the... -
Strange behavior
The problem seems to be in c code calling ruby calling c code. ======== start test.rb puts "about to require curses" require "curses" puts... -
Very strange file upload behavior
I tried to search for this issue on the group, but don't even know where to start, so here's my problem. We have a very simple form which has a... -
Strange behavior of $.
Apparently $. is not always set correct (see second ruby 1liner). Is this a bug? 12:12:42 : cat -n n 1 2 3 BAR="hello" 4 12:12:47 : ruby... -
Displaying Excel from my CGI
I have created a table from my CGI program with data coming from Postgres
and I want to now display this table as an Excel file. How can this be done?
Thanks!
Kevin
Guest
-
Tad McClellan #3
Re: Strange behavior after reading big file
J Krugman <jill_krugman@yahoo.com> wrote:
> for my $x (<HUGE>) {> but I need to run it on a file that is 25 million lines long,
Then don't read the entire thing into memory:
while ( my $x = <HUGE> ) {
--
Tad McClellan SGML consulting
[email]tadmc@augustmail.com[/email] Perl programming
Fort Worth, Texas
Tad McClellan Guest
-
John Bokma #4
Re: Displaying Excel from my CGI
[email]kbass@midsouth.rr.com[/email] wrote:
Turn it into csv or tsv (tab separated values) which can be imported> I have created a table from my CGI program with data coming from Postgres
> and I want to now display this table as an Excel file. How can this be done?
> Thanks!
into Excel.
--
Kind regards, feel free to mail: mail(at)johnbokma.com (or reply)
virtual home: [url]http://johnbokma.com/[/url] ICQ: 218175426
John web site hints: [url]http://johnbokma.com/websitedesign/[/url]
John Bokma Guest
-
J Krugman #5
Re: Strange behavior after reading big file
In <slrnblkmrq.76h.tadmc@magna.augustmail.com> [email]tadmc@augustmail.com[/email] (Tad McClellan) writes:
>J Krugman <jill_krugman@yahoo.com> wrote:>> for my $x (<HUGE>) {>> but I need to run it on a file that is 25 million lines long,>Then don't read the entire thing into memory:Yikes. What a whopper.> while ( my $x = <HUGE> ) {
Thank you so much!
-Jill
J Krugman Guest



Reply With Quote

