OT:Perl on Windows
Zbigniew Koziol
zkoziol-Zd07PnzKK1IAvxtiuMwx3w at public.gmane.org
Fri Mar 11 19:55:40 UTC 2005
John Macdonald wrote:
> One additional note: if there is any chance that you'd ever
> be copying a file that is large, it would be better to avoid
> loading the entire file into memory before writing it back out.
>
> Change:
>
> while (<TXT>) {
> $data .= $_;
> }
>
> print $data;
>
> print OUT $data;
>
> To:
>
> while (<TXT>) {
> print $_;
> print OUT $_;
> }
>
No... this doesn't matter. The first print will only allow to test if
input data are there.
One may also just write
print;
print OUT;
when using $_.
And a one-liner version I posted before (its different a bit from the
original one of William, since file names are define as STDIN and STDOUT
on command line):
perl -e 'while(<>){ print; }' < input.txt > aoutput.txt
zb.
--
Zbigniew Koziol, SoftQuake^(tm) Open Source Business Solutions
Web Development, Linux, Web Mail Fax Voice Servers, Networking
Consultations, Innovative Technologies Tel/Fax: 1-416-530-2780
Toronto, Canada, http://www.softquake.ca, info-lcEyp1+e+UdAFePFGvp55w at public.gmane.org
--
The Toronto Linux Users Group. Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml
More information about the Legacy
mailing list