On Tue, May 03, 2005 at 11:11:46PM +0200, demerphq wrote:

> The reason i keep saying a "modifier" is that I like the way changing
> the behaviour of -e,-p,-n resolves the ambiguity of mixing the two
> forms. For instance if -E simply changes the behaviour of any
> following -e,-p,-n then
> 
> -Ee "1;" -n "2;"  -e "3;" -p "4;" -e "5;" 
> 
> would produce 
> 
> 1;
> while (<>) {2;}
> 3;
> while (<>) {4;} continue {print;}
> 5;

Would it be up to the programmer to remember to include code in 2 to break
out of the loop early, so that the second loop actually has some input left
to iterate over?

Is -E -n"1;" -n"2;" equivalent to

while (<>) {1;}
while (<>) {2;}

or

while (<>) {1; 2;}

?

If the former, how do you include multiple lines inside the loop?  If the
latter, how do you put one loop right after another?

If the programmer wants two separate loops over <> in your program, he
should probably just write the code himself.  Is it really worth the added
complexity to support multiple -p and/or -n in the same command line?  I'm
curious whether people think this would actually see a lot of use.

Ronald

Reply via email to