Re: Need help with a question.



Anonymous coward <anonymous@xxxxxxx> wrote:
On Sat, 28 Jun 2008 13:18:08 -0700, Trev wrote:
open (OTF, ">blah.txt");
print OTF $DAT;

That makes no sense at all. Why would you want to print a filehandle

Maybe he wants to print _to_ a filehandle?

open (TMP, ">>$mactmp");
print TMP "$server". "," . "$cpqlogline\n"; close TMP;

Why do you open and close a file inside a loop?

Indeed, that is an expensive operation that is better done once outside
of the loop.

Why don't you just say
print "$server,$cpglogline\n" ?

Mabye because (unless you set the default filehandle using select()) the
text will end up on the screen instead of in the file?

This program makes absolutely no sense to me. What are you trying to do
exactly? Can you give a bit more description?

It is certainly somewhat cryptic.

jue
.



Relevant Pages

  • Way to free memory as I input lines from a file?
    ... >memory then enter a loop where I input each line one by ... >I don't totally understand what the Filehandle & Freefile ... >be quicker to use (Open openfile For Binary Access Read ... >Below is a very cut down version of the loop I'm running, ...
    (microsoft.public.excel.programming)
  • Re: simple perl script on Windows
    ... Rather than getting the output of `dir`, just loop through the ... so it *ends* with a whitespace character - the ... print $FILE2 $line; ... filehandle, which it can't do, so the loop never executes. ...
    (perl.beginners)
  • Way to free memory as I input lines from a file?
    ... memory then enter a loop where I input each line one by ... I don't totally understand what the Filehandle & Freefile ... be quicker to use (Open openfile For Binary Access Read ... Below is a very cut down version of the loop I'm running, ...
    (microsoft.public.excel.programming)
  • Re: text wrap help...
    ... The "problem" is that you are reading the file with a whileloop. ... To maintain "good" practice and process the file with a whileloop, ... filehandle for DATA and print to your filehandle instead of STDOUT): ... 231146-76811 S.S. TAG-REF DESIG LABEL KIT ...
    (perl.beginners)
  • Re: Extarcting And Storing a String
    ... Digger wrote: ... will handle the file-opening for you. ... use openand a different while loop that uses the open's filehandle. ...
    (comp.lang.perl.misc)