my $s = "ABCD";
print ("$s\n");
my $x = \$s;
print ("$$x\n");
다음은 포인터를 이용해서 Array slice 를 얻어본 예. my @a = (0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100);
my $p = \@a;
my @q = @$p[3 .. 6];
my @r = @$p[3, 4, 6];
foreach(@a){
print("$_ ");
}
print("\n");
foreach(@$p){
print("$_ ");
}
print("\n");
foreach(@q){
print("$_ ");
}
print("\n");
foreach(@r){
print("$_ ");
}
print("\n");
검색어 : google > pointer perl레퍼런스 :
Advanced Perl Programming - Chapter 1: Data References and Anonymous Storage
References in Perl 5
No comments:
Post a Comment