Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Data length in strings

by ChOas (Curate)
on Jul 24, 2001 at 14:58 UTC ( [id://99285]=note: print w/replies, xml ) Need Help??


in reply to Data length in strings

It might be easier to undef $/ (The input record separator,
which is normaly "\n") it has the same effect...

e.g.:
... open, etc... my $File { local $/; $File=<FILE>; } ...

Limitation is you memory....

check: perldoc perlvar

p.s. Thank you Tye

GreetZ!,
    ChOas

print "profeth still\n" if /bird|devil/;

Replies are listed 'Best First'.
Re: Re: Data length in strings
by khippy (Scribe) on Jul 24, 2001 at 16:24 UTC
    Once I encountered a problem concerning an exported peagasus mailfile. It was several hundreds of megabytes big. My oportunity was to split it into parts, each containing exactly one mail. As the file had a nice seperator, it seemed quite easy to me - but the first attempt blew up my memory. This was the first time I came to use the $_ variable instead of an own:
    open(FH,"<$source") || die "cant open $source: $!\n"; while (<FH>){ push @file, $_; if ($_ =~ /^-- End --/) { $zaehler++; open(GUN,">$destiny") || die "can write to $destinyfile$zaehle +r:$!"; foreach $zeile (@file) { print GUN $zeile; }#endforeach undef @file; close(GUN); print "$zaehler:\n"; }#endif }#endwhile close(FH);

    easy code, sent in the hope it helps you

    there are no silly questions
    killerhippy

    Edit ar0n -- 2001-07-24 fixed excessive whitespace

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://99285]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-03-28 19:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found