in reply to write/syswrite return value differences

Perl's write has nothing to do with the write system call. (What you call the C write.) It a record formatting function.

Replies are listed 'Best First'.
Re^2: write/syswrite return value differences
by Eliya (Vicar) on Nov 24, 2011 at 18:07 UTC

    I suppose the OP is talking about the IO::Handle method write, and was probably misled by the wording 'is like "write" found in C':

    $io->write ( BUF, LEN [, OFFSET ] )

    This "write" is like "write" found in C, that is it is the opposite of read. The wrapper for the perl "write" function is called "format_write".
      Ah yes. Then it should probably return the bytes written. Unfortunately, it doesn't have that information available, and it wouldn't be feasible to do that.

      That's right, I misread the docs thinking it's mirroring C's write() function...

      oh well, thanks!

        hum, Eliya pointed out that I was wrong and that IO::Handle's write does mirror C's (really POSIX's) write. Except in return value, of course.

        "This write is like write found in C"