2011年10月21日 星期五

雜湊初始化:具名雜湊用( ) ;匿名雜湊用{ }

# An ordinary hash uses the prefix and is initialized with a list
# within parentheses
%hash = ("flock" => "birds", "pride" => "lions");#()


# An anonymous hash is a list contained within curly braces. 
# The result of the expression is a scalar reference to that hash.
$rhash = {"flock" => "birds", "pride" => "lions"};#{}

沒有留言:

張貼留言