in reply to Re^2: sysread and null characters
in thread sysread and null characters
Ok, maybe I should have been a wee bit more explicit on the sysread part. What you want is:
The fourth parameter to sysread is called "offset". But it's not the offset into the file, it's the offset into the buffer (in your case, $digit). All file-reading functions read from the "current file position". Always. You can change the "current file position" on physical files (using seek), but not on all filehandles (e.g., a pipe from another process, or a socket). The act of reading from (or writing to) a file handle implicitly advances the position.sysread DF, $digit, $c;
The purpose of the offset in sysread, then, is to automatically concatenate multiple reads in a single buffer. This is not what you're doing.
The reason for the .* parts in a substitution (s///) operator is to have the regular expression match the whole string. This way you're replacing the whole string rather than just replacing the digit (with itself). You may want to peruse the Regular expression tutorial and/or the regular expression reference for more info here.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: sysread and null characters
by ggg (Scribe) on Mar 24, 2005 at 17:18 UTC | |
by Tanktalus (Canon) on Mar 24, 2005 at 18:10 UTC | |
by ggg (Scribe) on Mar 24, 2005 at 18:50 UTC |