print "\nlist as a stack (after push to top): \n"; @words=(); push (@words, 'NS'); push (@words, 'IE'); push (@words, 'Opera'); for ($index = 0; $index<@words; $index++) { print "$words[$index]\n"; } print "\nafter pop (from stack / top of stack)\n"; $x = pop (@words); for ($index = 0; $index<@words; $index++) { print "$words[$index]\n"; } print "the poped element is $x\n"; print "\nafter shift (from stack / bottom of stack)\n"; $x = shift (@words); for ($index = 0; $index<@words; $index++) { print "$words[$index]\n"; } print "the shifted element is $x\n"; print "\nadd element to (stack / bottom of stack)\n"; unshift (@words, "Mosaic"); for ($index = 0; $index<@words; $index++) { print "$words[$index]\n"; }