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!,

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