develooper Front page | perl.perl5.porters | Postings from November 2016

RE: [perl #130038] Builtin variable for loop index in foreach

Thread Previous
From:
Ed Avis
Date:
November 9, 2016 11:09
Subject:
RE: [perl #130038] Builtin variable for loop index in foreach
Message ID:
d1ddfe4b3bf249eaa95c5f0ec7e88efd@WCL-EX13MBX.wcl.local
Dave Mitchell wrote:

>No, at the point where you have iterated  'for (11..20) {}' say, 7 times,
>exactly two values are currently stored: 17 and 20.

Ah I see.  So when looping over a range, the start of the range would need to be stored
in case of later calls to $#.  At least that is only once per loop, not per iteration.

-- 
Ed Avis <eda@waniasset.com>

This email is intended only for the person to whom it is addressed and may contain confidential information. Any retransmission, copying, disclosure or other use of, this information by persons other than the intended recipient is prohibited. If you received this email in error, please contact the sender and delete the material. This email is for information only and is not intended as an offer or solicitation for the purchase or sale of any financial instrument. Wadhwani Asset Management LLP is a Limited Liability Partnership registered in England (OC303168) with registered office at 9th Floor Orion House, 5 Upper St Martin’s Lane, London, WC2H 9EA. It is authorised and regulated by the Financial Conduct Authority.

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