Dave Mitchell wrote: >For ranges, e.g. (1..10) and ('a'..'z'), it only records the current value and the last value. But for numeric ranges, if you know the current value it is just a subtraction to find its index. For string ranges like 'aa'..'zz' it is trickier but still possible. So fetching $# could do that? >give $# get magic that searches the context stack for a loop context, >then retrieves the current loop index stored in there. That wouldn't >slow down normal loops, but accessing $# itself might be quite slow. I think it would still be faster than the equivalent handwritten code using an $i variable, though? My concern would be whether in all cases 'searching the context stack for a loop' gives exactly the same semantics as we currently have for $_ in nested loops. Or whether the odd differences are not worth worrying about. -- 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 | Thread Next