- 论坛徽章:
- 145
|
1. 有问要有回
http://bbs.chinaunix.net/thread-4255120-1-1.html
2. 错误方法勿学
试试
$result{"a"}{"b"}=1;
$result{"b"}{"c"}=1;
3. 看doc
$ perldoc perldata
NAME
perldata - Perl data types
DESCRIPTION
Variable names
Perl has three built-in data types: scalars, arrays of scalars, and
...
Scalar values are always named with '$', even when referring to a scalar
that is part of an array or a hash. The '$' symbol works semantically like
the English word "the" in that it indicates a single value is expected.
$days # the simple scalar value "days"
$days[28] # the 29th element of array @days
$days{'Feb'} # the 'Feb' value from hash %days
$#days # the last index of array @days
Entire arrays (and slices of arrays and hashes) are denoted by '@', which
works much as the word "these" or "those" does in English, in that it
indicates multiple values are expected.
@days # ($days[0], $days[1],... $days[n])
@days[3,4,5] # same as ($days[3],$days[4],$days[5])
@days{'a','c'} # same as ($days{'a'},$days{'c'}) |
|