Saturday, December 29, 2012

Perl 에서 array of arrays 를 다루는 방법

1:  my @aa = ();  
2:  my @a = ("Mega", "Giga", "Tera");  
3:  my @b = ("Centi", "Milli", "Nano");  
4:  push(@aa, \@a);  
5:  push(@aa, \@b);  
6:  foreach(@aa){  
7:         foreach(@$_){  
8:                print();  
9:                print(" ");  
10:         }  
11:         print(" -> First Element is $_->[0]");  
12:         print("\n");  
13:  }  

No comments:

Post a Comment