Using Arrays as Stacks : stack « Array « Perl






Using Arrays as Stacks

   


#!/usr/local/bin/perl -w

push (@myList, "Hello");
push (@myList, "World!");
push (@myList, "How");
push (@myList, "Are");
push (@myList, "You?");

while ( $index = pop(@myList) )
{
   print "Popping off stack: $index\n";
}

   
    
    
  








Related examples in the same category