Monday, December 24, 2012

Perl 에서의 array 사용 예

 use strict;  
 use warnings;  
   
 my @arr = ("Mio", "Ritsu");   
 printArray(@arr);   
   
 push(@arr, "Yui");   
 push(@arr, "Tsumugi");   
 printArray(@arr);   
   
 my $name = pop(@arr);   
 print($name, "\n");   
   
 printArray(@arr);   
   
 sub printArray {   
      foreach (@_){   
        print();    
        print(" ");   
      }   
      print("\n");   
 }   
Some Useful Array Functions

No comments:

Post a Comment