in reply to Re^4: file handing
in thread file handing

Hello bigup401,

but i get my pics with zero bytes

As johngg said below, you’re clobbering (i.e., truncating, deleting the contents of) the file by opening it for writing with >. From perlfaq5:

How come when I open a file read-write it wipes it out?

Because you're using something like this, which truncates the file then gives you read-write access:

open my $fh, '+>', '/path/name'; # WRONG (almost always)

Whoops. You should instead use this, which will fail if the file doesn't exist:

open my $fh, '+<', '/path/name'; # open for update

Using ">" always clobbers or creates. Using "<" never does either. The "+" doesn't change this.

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,