Are you serious?  $.., $..., $.... etc?!  Aiieeee!!! he screams and runs away.  
Please stop this thread.

Hopefully helpfully yours, 
Steve 
-- 
Steve Tolkin    Steve . Tolkin at FMR dot COM   508-787-9006
Fidelity Investments   82 Devonshire St. M3L     Boston MA 02109 
There is nothing so practical as a good theory.  Comments are by me, 
not Fidelity Investments, its subsidiaries or affiliates. 



 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Duane Bronson
Sent: Thursday, September 21, 2006 7:03 PM
To: Ronald J Kimball
Cc: boston-pm@mail.pm.org; Palit, Nilanjan
Subject: Re: [Boston.pm] Loop index in foreach?

$.. should be the iterator count in the parent loop, $... should be the 
iterator count in the grandparent loop, ...

my @fruits = ('apple','banana','cantaloupe');
foreach my $fruit  (@fruits) {
  foreach my $minusone (0..1000) {
    foreach my $plusone (2..1000) {
      die "inner loop count wrong" unless $plusone == $.+1;
      die "outer loop count wrong" unless $minusone == $..-1;
      die "way outer loop index wrong" unless $fruit eq $fruits[$...];
    }
  }

Ronald J Kimball wrote:
> On Thu, Sep 21, 2006 at 09:34:43AM -0700, Palit, Nilanjan wrote:
>
>   
>> I think it'd be fairly easy for Perl to auto initialize & increment a
>> loop index in all loops & provide that to the user in a special
>> variable. "$." is an excellent example. I think it'd be a great addition
>> to Perl's excellent (& long) list of special vars, making for yet more
>> elegant & concise code.
>>     
>
> What would you have Perl do in the case of nested loops?
>
> Ronald
>  
> _______________________________________________
> Boston-pm mailing list
> Boston-pm@mail.pm.org
> http://mail.pm.org/mailman/listinfo/boston-pm
>
>   

-- 
Sincerely       *Duane Bronson*
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
http://www.nerdlogic.com/
453 Washington St. #4A, Boston, MA 02111
617.515.2909

 
_______________________________________________
Boston-pm mailing list
Boston-pm@mail.pm.org
http://mail.pm.org/mailman/listinfo/boston-pm

 
_______________________________________________
Boston-pm mailing list
Boston-pm@mail.pm.org
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to