jeanluca has asked for the wisdom of the Perl Monks concerning the following question:
Can someone explain to me why this is just wrong and if it is not too much to ask, what is the solution ?#! /usr/bin/perl use strict ; use warnings ; my @a ; $a[0] = "a" ; $a[1] = "a" ; $a[2] = "b" ; $a[3] = "a" ; my $b = 0 ; $b ++ if ( $_ eq "b" ) foreach @a ; print "$b\n" ;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: problem with foreach
by bart (Canon) on Jun 16, 2006 at 07:41 UTC | |
by jeanluca (Deacon) on Jun 16, 2006 at 08:34 UTC | |
by bart (Canon) on Jun 16, 2006 at 08:39 UTC | |
by Jasper (Chaplain) on Jun 16, 2006 at 11:37 UTC | |
|
Re: problem with foreach
by McDarren (Abbot) on Jun 16, 2006 at 07:37 UTC | |
|
Re: problem with foreach
by Zaxo (Archbishop) on Jun 16, 2006 at 07:31 UTC | |
|
Re: problem with foreach
by Jasper (Chaplain) on Jun 16, 2006 at 08:55 UTC | |
|
Re: problem with foreach
by neniro (Priest) on Jun 16, 2006 at 07:39 UTC |