bobbybobbertson
Programmer
is there an easier way than the following to initialize an array to all zeros.
$cntr=0;
while ($cntr++ < 24) {
$array[$cntr]=0;
}
$cntr=0;
while ($cntr++ < 24) {
$array[$cntr]=0;
}
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
$numElems = 24;
@array = (0) x $numElems;
@array = (0) x @array;
#!/usr/local/bin/perl
$array[3] = '4';
foreach (@array) { print "Element: $_\n"; }
$array[1]++;
foreach (@array) { print "Element: $_\n"; }