S
stu7
+ Perl's SHIFT function seems to say that it both
reads, and removes, the first element of whatever array
is being used with it... shift or unshift for the first
or last array element is a handy idea, although I'm not
too sure why a separate function is needed for this...
...thats not my problem though
I tried using shift to erase the first element of an
array repeatedly, until it was empty... nice for a counting
program maybe...
$a = shift(@oneTOfive) ;
print $a ;
...here is where I got stuck... how do you print the first
shifted element, and then get to the next ? I actually tried
"next", which perl didnt accept.
I then tried a GOTO loop... and I know this function has
many fans in the perl community
... odd, with a goto, the
first element seemed to reprint, like it never got erased ?
Also, I tried my first big plate of perl spaghetti
So finally... after copying the above two lines for each
element, I was able to erase every element in the array, but
isn't there a simple [next type of thing] to use with SHIFT...
or is it just one of those simple functions that were never
intended to do fancy work ?
reads, and removes, the first element of whatever array
is being used with it... shift or unshift for the first
or last array element is a handy idea, although I'm not
too sure why a separate function is needed for this...
...thats not my problem though
I tried using shift to erase the first element of an
array repeatedly, until it was empty... nice for a counting
program maybe...
$a = shift(@oneTOfive) ;
print $a ;
...here is where I got stuck... how do you print the first
shifted element, and then get to the next ? I actually tried
"next", which perl didnt accept.
I then tried a GOTO loop... and I know this function has
many fans in the perl community
first element seemed to reprint, like it never got erased ?
Also, I tried my first big plate of perl spaghetti
So finally... after copying the above two lines for each
element, I was able to erase every element in the array, but
isn't there a simple [next type of thing] to use with SHIFT...
or is it just one of those simple functions that were never
intended to do fancy work ?