develooper Front page | perl.perl5.porters | Postings from December 2011

[perl #22335] foreach auto dereference (feature request)

Thread Next
From:
James E Keenan via RT
Date:
December 2, 2011 17:33
Subject:
[perl #22335] foreach auto dereference (feature request)
Message ID:
rt-3.6.HEAD-5084-1322875988-993.22335-15-0@perl.org
On Tue May 27 00:21:53 2003, asperl wrote:
> 
> This is a feature request:

> @list = ([1,2], [2,3]); # an array of arrays
> 
> I would like to be able to write:
> 
> foreach my @sublist (@list) {
> ....
> }
> 
> This would be equivalent to:
> 
> foreach (@list) {
>   my @sublist = @$_;
> ....
> }
> 
> Same for hashes.
> 
> This request is specifically for foreach - since foreach expects a scalar,
> if it sees a list or a hash it knows to do something special.
> 
> Need to decide what to do if an element in list is not actually a
> ref, but rather a scalar.
> 

Does anyone wish to comment on this feature request?

Thank you very much.
Jim Keenan

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