Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^6: First attempt at bringing in file for input/output

by soonix (Canon)
on Oct 26, 2018 at 08:15 UTC ( [id://1224721]=note: print w/replies, xml ) Need Help??


in reply to Re^5: First attempt at bringing in file for input/output
in thread First attempt at bringing in file for input/output

but but but … isn't "end of <DATA>" the end-of-loop condition?

reacting to a /Q(uit)?/i input is more or less just a convenience function, thus secondary :-)

Replies are listed 'Best First'.
Re^7: First attempt at bringing in file for input/output
by Marshall (Canon) on Nov 02, 2018 at 23:37 UTC
    You are quite correct.
    My examples were quickly contrived with the focus on variable scoping of something in a while loop which has a logical conditional expression.

    For a normal while (my $line = <$fh>){} loop, I would usually have something like "next if blank line" in the body of the loop. The idea expressed in the loop conditional being that all lines will be looked at.

    For a command loop, one that is interactive with the user, I would express the idea that "this loop usually ends when the user types "quit" of some variant of that" within the while() statement. I would prefer that as opposed to "last if ...." within the body of the loop. I didn't frame examples in the context of a command loop from <STDIN> because testing such things takes a few extra steps in my dev environment. My code tends to have either a super fancy GUI or no UI at all, with the later case being far and away the most common. I tend to write "middleware" data processing or system code.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (7)
As of 2024-04-18 11:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found