•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Perl section within the Software Development category of DaniWeb, a massive community of 391,591 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,680 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Perl advertiser:
Views: 4249 | Replies: 1
![]() |
•
•
Join Date: Dec 2004
Location: Lincoln Park, Michigan
Posts: 1,744
Reputation:
Rep Power: 7
Solved Threads: 107
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)
•
•
•
•
•
•
•
•
DaniWeb Perl Marketplace
Similar Threads
- Array (C++)
- Comparing an element in an array (C++)
- Array of pointers (C++)
- Need help with Array Validation (C++)
- single-dimensional array trouble (C++)
- Help with copying an array into a struct (C)
- strcmp of 2-D array (C)
- MERGED: Deleting duplicates in an array (plz help me out!!!!!!!) (C)
Other Threads in the Perl Forum
- Previous Thread: finding a character string
- Next Thread: i get an error while trying to run perl on win98



Linear Mode