Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^3: What's the right way to write a method which returns one line at a time from a file?

by AnomalousMonk (Bishop)
on Nov 22, 2020 at 07:08 UTC ( #11124006=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    if ( my $line = readline( $self->{file_handle} ) ) {
        return $line;
    } else {
        return;
    }
    
  2. or download this
    if (defined(my $line = readline( $self->{file_handle} ))) {
        return $line;
    } else {
        return;
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11124006]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2021-03-03 21:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favorite kind of desktop background is:











    Results (94 votes). Check out past polls.

    Notices?