diff options
author | Hans Mulder <hansmu@xs4all.nl> | 1998-06-05 04:08:40 -0700 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1998-06-10 06:51:08 +0000 |
commit | 5b2b9c687790241e85aa7b76aaeec8b744ce6b49 (patch) | |
tree | 93b74d9f604f921db988b77aa85c2a408e97b2bd /pod | |
parent | a9fd575dd92ad717baa6b7171a8f5bbb5221fcc7 (diff) | |
download | perl-5b2b9c687790241e85aa7b76aaeec8b744ce6b49.tar.gz |
Mangled patch, needed hand-tweaks, along with binmode for rs.t:
Message-Id: <3.0.5.32.19980605110840.009e12b0@ous.edu>
Subject: Re: [PATCH 5.004_66]Add record read capability to <>
p4raw-id: //depot/perl@1099
Diffstat (limited to 'pod')
-rw-r--r-- | pod/perlvar.pod | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/pod/perlvar.pod b/pod/perlvar.pod index 2cb95afe05..d9edffa58a 100644 --- a/pod/perlvar.pod +++ b/pod/perlvar.pod @@ -222,6 +222,27 @@ character belongs to the next paragraph, even if it's a newline. Remember: the value of $/ is a string, not a regexp. AWK has to be better for something :-) +Setting $/ to a reference to an integer, scalar containing an integer, or +scalar that's convertable to an integer will attempt to read records +instead of lines, with the maximum record size being the referenced +integer. So this: + + $/ = \32768; # or \"32768", or \$var_containing_32768 + open(FILE, $myfile); + $_ = <FILE>; + +will read a record of no more than 32768 bytes from FILE. If you're not +reading from a record-oriented file (or your OS doesn't have +record-oriented files), then you'll likely get a full chunk of data with +every read. If a record is larger than the record size you've set, you'll +get the record back in pieces. + +On VMS, record reads are done with the equivalent of C<sysread>, so it's +best not to mix record and non-record reads on the same file. (This is +likely not a problem, as any file you'd want to read in record mode is +proably usable in line mode) Non-VMS systems perform normal I/O, so +it's safe to mix record and non-record reads of a file. + =item autoflush HANDLE EXPR =item $OUTPUT_AUTOFLUSH |