icon Top 9 categories map      RocketAware > Perl >

input_record_separator HANDLE EXPR
$INPUT_RECORD_SEPARATOR
$RS
$/

Tips: Browse or Search all pages for efficient awareness of Perl functions, operators, and FAQs.



Home

Search Perl pages


Subjects

By activity
Professions, Sciences, Humanities, Business, ...

User Interface
Text-based, GUI, Audio, Video, Keyboards, Mouse, Images,...

Text Strings
Conversions, tests, processing, manipulation,...

Math
Integer, Floating point, Matrix, Statistics, Boolean, ...

Processing
Algorithms, Memory, Process control, Debugging, ...

Stored Data
Data storage, Integrity, Encryption, Compression, ...

Communications
Networks, protocols, Interprocess, Remote, Client Server, ...

Hard World
Timing, Calendar and Clock, Audio, Video, Printer, Controls...

File System
Management, Filtering, File & Directory access, Viewers, ...

    
input_record_separator HANDLE EXPR
$INPUT_RECORD_SEPARATOR
$RS
$/
The input record separator, newline by default. Works like awk's RS variable, including treating empty lines as delimiters if set to the null string. (Note: An empty line cannot contain any spaces or tabs.) You may set it to a multi-character string to match a multi-character delimiter, or to undef to read to end of file. Note that setting it to "\n\n" means something slightly different than setting it to "", if the file contains consecutive empty lines. Setting it to "" will treat two or more consecutive empty lines as a single empty line. Setting it to "\n\n" will blindly assume that the next input character belongs to the next paragraph, even if it's a newline. (Mnemonic: / is used to delimit line boundaries when quoting poetry.)

    undef $/;
    $_ = <FH>;          # whole file now here
    s/\n[ \t]+/ /g;

Remember: the value of $/ is a string, not a regexp. AWK has to be better for something :-)

Source: Perl predefined variables
Copyright: Larry Wall, et al.
Next: autoflush HANDLE EXPR
$OUTPUT_AUTOFLUSH
$|


Previous: input_line_number HANDLE EXPR
$INPUT_LINE_NUMBER
$NR
$.




(Corrections, notes, and links courtesy of RocketAware.com)


[Overview Topics]

Up to: File filtering and processing




Rapid-Links: Search | About | Comments | Submit Path: RocketAware > Perl > perlvar/input_record_separator.htm
RocketAware.com is a service of Mib Software
Copyright 2000, Forrest J. Cavalier III. All Rights Reserved.
We welcome submissions and comments