develooper Front page | perl.perl6.language | Postings from April 2002

Re: The new =~, and chaining statement modifiers

Thread Previous
From:
Aaron Sherman
Date:
April 4, 2002 11:05
Subject:
Re: The new =~, and chaining statement modifiers
Message ID:
1017947066.3172.146.camel@pps
On Wed, 2002-04-03 at 20:49, Larry Wall wrote:

> : Additionally, can you chain statement modifiers?
> : 
> : do_this() if $a unless $b;
[...]
> No, still can't chain them.

That's a darned shame. In p5, I keep going back to code and finding
something like:

	print foreach @x;

and wanting to change it to:

	print foreach @x if @x > 2;

or finding this:

	print $_ if /^X/;

and wanting:

	print $_ if /^X/ for split /\n/;

Yes, I know this last one can be accomlished by:

	print $_ while /^(X.*)/mg;

but the former always seems more obvios to me.



Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About