Is there a command in Perl that will strip off the last element in an array and replace it with a constant value?
bigfoot_80906
0
Newbie Poster
Recommended Answers
Jump to PostNot to replace it so much, but you could just as easily do a pop and then an immediate push. So, something like:
$retval = pop(@arrayname); push @arrayname, $newvalue;
so, $retval will contain the last item in the array, but the array will be one element less, …
All 2 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.