Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: [perl #35091] perlrun: -e -p -p -e all the same...

1 view
Skip to first unread message

Yitzchak Scott-Thoennes

unread,
May 4, 2005, 8:15:26 PM5/4/05
to perl5-...@perl.org, go...@perl.org, Brad Baxter, demerphq, Abigail, H.Merijn Brand
On Wed, May 04, 2005 at 11:26:24AM -0400, Brad Baxter wrote:
> On Wed, 4 May 2005, Ronald J Kimball wrote:
> [...]
> >
> > 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.
>
> As for me, I'm not wedded to the idea. I just started thinking out
> loud when it sounded like folks were edging toward working on a patch.

'twould be good to consult some golfers on what they would find
helpful. (No, I'm not joking.)

Ton Hospel

unread,
May 5, 2005, 7:44:10 AM5/5/05
to go...@perl.org
In article <20050505001526.GB3508@e_n.org>,

Actually a -E style patch would have little influence on golf as
it's usually played here since we only use options on the #!perl line,
which is not where this stuff would happen. We also don't use -M and
options like that for the same reson. And since we put the code in the
file body we already don't have the explicit -e.

There's also the point that in golf it's mostly an END{} block that's
wanted, and these are kindof solved by using the }{ trick:

perl -lpe '}{$_=$.' < /etc/passwd

BEGIN is also sometimes needed and has no good standard solution.
Usually something with INIT{} is used.

(writing this makes me realize we might want to discuss the scope of
-l and -0 options if we're going to support multiple -p and -n)

The reason I like the idea is not for golf but for commandlines

0 new messages