in reply to How do I reset an array?
But you don't need to do that to get your code to work:@arr = ();
Also, don't forget about join which will replace the for loop and concatention for you (and do a much better job anyway):use strict; # ALWAYS!!! my @array = &getarray(); my $blah; foreach my $val (@array) { $blah .= ",$val"; } print "$blah\n"; sub getarray { return ('a'..'d'); }
print join(',', getarray()), "\n";
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (jeffa) Re: Arrays
by dsheroh (Monsignor) on May 06, 2002 at 19:45 UTC | |
by jeffa (Bishop) on May 06, 2002 at 20:06 UTC | |
by Jaspersan (Beadle) on May 07, 2002 at 00:14 UTC | |
by dsheroh (Monsignor) on May 06, 2002 at 21:56 UTC | |
by jeffa (Bishop) on May 06, 2002 at 22:21 UTC | |
by c-era (Curate) on May 06, 2002 at 19:59 UTC |