: ,
(hashes) - .
, - .
.
.
'$'
.
$var1 # 'var1'
$var1[0] # 'var1'
$var1{'first'} # 'first'
"" ""
'@'.
@var1 # var1 ( $var1[0], $var1[1], ... $var1[n])
@var1[1,3,10] # $var1[1], $var1[3], $var1[10]
@var1{'first','last'} # ( $var1{'first'}, $var1{'last'} )
"" '%'.
:
%var, %key, %years
'&'
.
:
&sub1, &test_prog, test(12)
'*'.
$var1 $var1[0]
, $var1[0] @var1. \
@var1 %var1 - .
-
. .
$var1 $Var1 -
.
.
..
"" .
: (list).
-
. - .
:
$var1 = <>; #
@var1 = <>; # @var1
$var1 = (1,2,3); # $var = 3 -
@var1 = (1,2,3); # @var1 1,2,3
, .
, .
- .
,
. -
.
"" "" "" .
.
"TRUE" ()
0.
(null) -
(defined) (undefined).
- .
, . defined()
.
$# csh. $#var1 -
.
0
$#var1+1 . $#var1 -
"" .
$#var1
- , -
.
(
).
:
@var1 = (4, 3, 2, 1); #
$i = @var1; #
print $i; # 4 - -
print @var1; # , .
scalar().
:
print scalar(@var1); #
"true"
"-".
2/8 8 - ""
2 - .
.
:
123
123.123
0.12
.12E-10
0xABCD #
0377 # 0 -
123_456_123 # .
(') (") :
', !'
" ."
.
qq.
.
:
$var1{first} $var1{'first'}
-
.
__LINE__
( ), __FILE__ ( ).
__END__
,
DATA.
""
.
.
"here-doc" ( ) .
<< -.
:
print < .
-
.
.
:
@var1 = (1, 2, '', 1.2); # .
$var1[0] = 1,
$var1[1] = 2,
$var1[2] = ''
$var1[3] = 1.2
$var1 = (1, 2, '', 1.2);
$var1 = 1.2 .. .
,
.
:
@s1 = (1, 2, 3); #
@s2 = (6, 7, 8); #
@s = (0, @s1, 4, 5, @s2, 9, 10); # @s1 @s2
print @s; # : 012345678910 - .
() -.
,
.
:
print ('','','')[1];
:
.
:
($a, $b, $c) = (1, 2, 3); # $a = 1, $b = 2, $c = 3
.
:
$x = (($a, $b, $c) = (1,2)); # $x=2
: -.
:
%_ = ('', 31, '', 30);
: $_{} = 31, $_{} = 30
=> .
:
%_ = (
=> 31,
=> 30,
);
typeglog
. '*'.
,
.
.
:
sub new_sub
{ local *IN; #
open (IN, "test") || return undef; # . .
.........
return;
}
.
Last-modified: Thu, 24 Apr 1997 17:45:34 GMT