John J Reiser on Sat, 12 Oct 2002 22:18:20 -0400


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: for my ...


I've used a similar construct (using foreach) and never had any problem (AS 5.6.1).

I also under the impression that for and foreach are interchangeable, though I can't be 100% sure.

The construct you mentioned should be valid. What error(s) have you been getting?

Hope this helps,
John

At 09:58 PM 10/12/2002 -0400, you wrote:
I've often used, without problem, the construct

    for my $foo (@bar) {
        do_stuff($foo);
    }

I once saw a version of perl that wasn't happy with this (5.00x.y, I
think). I saw another today (5.6).

I thought this was supposed to be a perfectly legal and reasonable
thing to do. Am I mistaken or confused? I hate having to say

    my $foo;
    for $foo (@bar) {
        do_stuff($foo);
    }

--
 Jeff

 Jeff Abrahamson  <http://www.purple.com/jeff/>

**Majordomo list services provided by PANIX <URL:http://www.panix.com>**
**To Unsubscribe, send "unsubscribe phl" to majordomo@lists.pm.org**

John Reiser www.newrisedesigns.com <http://www.perlmonks.org/index.pl?node_id=136291>www.perlmonks.<http://www.perlmonks.org/index.pl?node_id=136291>org

**Majordomo list services provided by PANIX <URL:http://www.panix.com>**
**To Unsubscribe, send "unsubscribe phl" to majordomo@lists.pm.org**


  • References:
    • for my ...
      • From: Jeff Abrahamson <jeff@purple.com>