cc:
[EMAIL PROTECTED]
Subject:
RE: problem with variables
At 10:59 AM 4/17/2001, you wrote:
>i have this program:
>
>$sup1='a';
>$sup2='b';
>$sup3='c';
>
>for ($i=1 ; $i<4 ;$i++){
> print $sup($i);
>}
>
>but give error, why???
First off, you need to make an array. All you have are some scalars with
similar names. You could use symbolic references
Good point ... note to self ... don't try and help people while to busy
to really focus on problem.
I jumped down to the loop without looking at the code
Tad McClellan wrote:
> On Tue, Apr 17, 2001 at 02:01:14PM -0700, James Fisher wrote:
>
> > the array starts at 0 not 1
> ^
>
> The
On Tue, Apr 17, 2001 at 02:01:14PM -0700, James Fisher wrote:
> the array starts at 0 not 1
^
There is no array in the code given (but there probably should be).
> you should realy look at foreach instead
>
>
> Pacifico wrote:
>
> > i have this program:
> >
> > $sup1='a';
> > $su
the array starts at 0 not 1
you should realy look at foreach instead
Pacifico wrote:
> i have this program:
>
> $sup1='a';
> $sup2='b';
> $sup3='c';
>
> for ($i=1 ; $i<4 ;$i++){
> print $sup($i);
> }
>
> but give error, why???
, April 17, 2001 1:55 PM
To: Pacifico
Cc: [EMAIL PROTECTED]
Subject: Re: problem with variables
To add to the answer(s) already given...
for ($i=1 ; $i<4 ;$i++){
print $sup($i);
}
is actually quite cumbersome, and very 'C'-ish... Let's make it more
Perl-ish...
for my $i
To add to the answer(s) already given...
for ($i=1 ; $i<4 ;$i++){
print $sup($i);
}
is actually quite cumbersome, and very 'C'-ish... Let's make it more
Perl-ish...
for my $i (1..4){
print $i;
}
There is not need to have to deal with incrementing and checking conditions
in loops - Perl
On Tue, 17 Apr 2001, Pacifico wrote:
> i have this program:
>
> $sup1='a';
> $sup2='b';
> $sup3='c';
>
> for ($i=1 ; $i<4 ;$i++){
> print $sup($i);
> }
>
> but give error, why???
Because, basically, you can't do that. To get the result you want, you
have to do this instead:
# Begin perl