in reply to Block device status and script termination

For things that need to work with low-level data like that you'd be much better off using syswrite instead of print.

Not only will syswrite not bother scanning the string for variable substitutions and such, but syswrite returns the number of bytes actualy written.

So instead of print DEST "$n" x $input; you should put in $written=syswrite(DEST,($n x $input)); and terminate when $written!=(length($n)*input)

Replies are listed 'Best First'.
Re: Re: Block device status and script termination
by ambrus (Abbot) on Feb 23, 2004 at 13:51 UTC

    What? Using syswrite as opposed to print has nothing to do with variable interpolation.

    I think print is good enough in this case, it's just that print may report the error (ENOSPC or else) later than it actually occurs because of buffering, but I dont think this would be a problem in this case. You can probably still get the position of the error with sysseek after print reports the error I think.