in reply to File Handle wierdness

you're not opening a filehandle correctly.

open( OUT, ">outfile" );

if you're planning to blow away the contents of the file each time you run your script, or

open( OUT, ">>outfile" );

if you want to update your code.

i'm surprised you're getting a filehandle opened at all . . .

UPDATE: i stand corrected. tye has the right idea - the filehandle is blocking. i had to do similar 'magic' on a project.

close the filehandle, then re-open it. that'll flush the buffer, and you should see ( at least ) the 'hello' string.

Replies are listed 'Best First'.
Re: Re: File Handle wierdness
by snax (Hermit) on Nov 22, 2000 at 14:25 UTC
    the_slycer is correct. From perlman:perldata:

    It is often more readable to use the => operator between key/value pairs. The => operator is mostly just a more visually distinctive synonym for a comma, but it also arranges for its left-hand operand to be interpreted as a string--if it's a bareword that would be a legal identifier. This makes it nice for initializing hashes:

    Since OUT is a legal bareword he's OK.

Re: Re: File Handle wierdness
by the_slycer (Chaplain) on Nov 22, 2000 at 11:46 UTC
    But, that's what I've done. The => does the same as the comma - unless I'm really missing something. I find it clearer to read that way.