Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Iterator to parse multiline string with \\n terminator

by three18ti (Scribe)
on Oct 06, 2013 at 05:46 UTC ( #1057121=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #/usr/bin/perl
    use strict;
    ...
    while (my $line = $fh_iterator->($fh)) {
        # do stuff to $line
    }
    
  2. or download this
        $line .= $fh_iterator->($fh) if $line =~ /\\\n/
    
  3. or download this
    sub fh_iterator {
        my $fh = shift;
    ...
        $line .= fh_iterator($fh) if $line =~ /\\\n/;
        return $line;
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1057121]
Approved by Athanasius
Front-paged by mtmcc
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2019-04-19 02:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I am most likely to install a new module from CPAN if:
















    Results (106 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!