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

Re: proposal: when-blocks, and binding $_

Thread Previous | Thread Next
From:
Allison Randal
Date:
February 26, 2002 13:45
Subject:
Re: proposal: when-blocks, and binding $_
Message ID:
20020226214502.GC1515@shadowed.net
On Tue, Feb 26, 2002 at 01:26:41PM -0800, Austin Hastings wrote:
> 
> Possibility B- when-blocks accept a -> operator, which if used "naked"
> binds the current localizer to $_.

I think if I had a choice between

given $y -> $x {
	when /a/ -> {...}
	when /b/ -> {...}
	...
}

and

given $y {
	when /a/ {...}
	when /b/ {...}
	...
}

I'd always prefer the second. Re-aliasing the aliased variable for every
when block doesn't quite seem worth the effort.

Allison

Thread Previous | Thread Next


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