in reply to sprintf and for loop weirds???
for (my $n = 0; $n <= scalar(@a); $n++) { ... }
Note the change in operator - Your code was only doing one iteration through the loop while $n was less than 1 and not less than or equal to 1. As such, it was only iterating through the loop once and setting $b[0] and not $b[1] - If you had more values in @a, you would have found it iterating through and acting on all except the last value.
Ooohhh, Rob no beer function well without!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: sprintf and for loop weirds???
by blakem (Monsignor) on Nov 04, 2001 at 16:15 UTC | |
by rob_au (Abbot) on Nov 04, 2001 at 16:20 UTC | |
by blakem (Monsignor) on Nov 04, 2001 at 16:26 UTC | |
by rob_au (Abbot) on Nov 04, 2001 at 17:30 UTC | |
|
Re: Re: sprintf and for loop weirds???
by chipmunk (Parson) on Nov 04, 2001 at 21:01 UTC |