in reply to Re^6: First attempt at bringing in file for input/output
in thread First attempt at bringing in file for input/output
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.
|
---|