2011年10月21日 星期五

用Arrow Notation 製作 shortcut

#arrowNotation.pl




@array = (1..10);
$rarray = \@array;
print $rarray->[1],"\n" ;    # The "visually clean" way
#instead of the approaches we have seen earlier:
print $$rarray[1],"\n";      # Noisy, and have to think about precedenceprint ${$rarray}[1];    # The way to get tendinitis!


#輸出結果:
2
2

沒有留言:

張貼留言