Please support our Perl advertiser: Programming Forums
Views: 4754 | Replies: 1
![]() |
•
•
Join Date: Dec 2004
Location: Lincoln Park, Michigan
Posts: 1,744
Reputation:
Rep Power: 7
Solved Threads: 108
Not to replace it so much, but you could just as easily do a pop and then an immediate push. So, something like:
so, $retval will contain the last item in the array, but the array will be one element less, and will not contain the last value any longer.... but $retval will. Then, you push the newvalue you want onto the array... this will essentially, remove the last element, and replace it with a new value...
$retval = pop(@arrayname); push @arrayname, $newvalue;
so, $retval will contain the last item in the array, but the array will be one element less, and will not contain the last value any longer.... but $retval will. Then, you push the newvalue you want onto the array... this will essentially, remove the last element, and replace it with a new value...
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)






Linear Mode