Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

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

by hippo (Bishop)
on Nov 25, 2020 at 09:44 UTC ( [id://11124187]=note: print w/replies, xml ) Need Help??


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

I see that construct as a perfectly legitimate way to handle returning different values in different cases.

It is legitimate but all those unnecessary elsifs and elses spread confusion. Why are they there if they serve no purpose? TIMTOWTDI but I prefer the clarity of

return A if FOO; return B if BAR; return C if BAZ; die "unmatched case";

🦛

  • Comment on Re^9: What's the right way to write a method which returns one line at a time from a file?
  • Select or Download Code

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (None)
    As of 2024-04-25 01:33 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found