If you can't read please download the document
Upload
alexey-bovanenko
View
1.124
Download
0
Embed Size (px)
Citation preview
Blue and Grey
Perl
,, ,
my $data=\123.43;
print $$data,"\n";
my $arr=[1,2,3,['a', 'b','c','d']];
foreach my $val (@$arr){
print $val,"\n";
}
my $myhash={
'key1' => 'value1',
'key2' => 'value2',
'key3' => 'value3'
};
foreach my $key (keys (%$myhash)){
print $myhash->{$key},"\n";
}
my $hashhash={
'hash1' => {'key1'=>'value11', 'key2'=>'value12'},
'hash2' => {'key1'=>'value21', 'key2'=>'value22'},
'hash3' => {'key1'=>'value31', 'key2'=>'value32'}
};
foreach my $hashkey (keys (%$hashhash)){
foreach my $key(keys (%{$hashhash->{$hashkey}})){
print $hashhash->{$hashkey}->{$key},"\n";
}
}
my $myprogr=sub { print "Hello, world!\n"; };
&$myprogr;
my $subroutine;
{
my $test="Test value";
$subroutine=sub{ return $test; };
}
my $test="It's the another variable";
print $test,"\n" if(defined ($test));
print &$subroutine,"\n";
e-mail: [email protected]