in reply to Reading from file, not to memory
When you reference a file handle in list context (by assigning to an array), you read the whole file at once into memory. You can intead read the file line by line by using the file handel in scalar context (by assigning to a scalar). Instead of this...
open(FH, "/path/to/file") || die "Can't open file: $!"; my @file = <FH>; close FH;
...try this...
open(FH, "/path/to/file") || die "Can't open file: $!"; foreach my $file (<FH>){ if($file eq $external_info){ print "great\!"; last; } } close FH;
--- print map { my ($m)=1<<hex($_)&11?' ':''; $m.=substr('AHJPacehklnorstu',hex($_),1) } split //,'2fde0abe76c36c914586c';
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Reading from file, not to memory
by cees (Curate) on Feb 20, 2003 at 04:33 UTC | |
|
Re: Re: Reading from file, not to memory
by gmpassos (Priest) on Feb 20, 2003 at 08:02 UTC | |
|
Re: Re: Reading from file, not to memory
by pfaut (Priest) on Feb 20, 2003 at 13:51 UTC |