26 lines
537 B
Perl
26 lines
537 B
Perl
|
#!/usr/bin/perl
|
||
|
|
||
|
%weekday = (
|
||
|
'01' => 'Mon',
|
||
|
'02' => 'Tue',
|
||
|
'03' => 'Wed',
|
||
|
'04' => 'Thu',
|
||
|
'05' => 'Fri',
|
||
|
'06' => 'Sat',
|
||
|
'07' => 'Sun',
|
||
|
);
|
||
|
$pointer = \%weekday;
|
||
|
$i = '05';
|
||
|
|
||
|
printf '$$pointer{$i} is ';
|
||
|
printf "$$pointer{$i} \n";
|
||
|
printf '${$pointer}{$i} is ';
|
||
|
printf "${$pointer}{$i} \n";
|
||
|
printf '$pointer->{$i} is ';
|
||
|
|
||
|
printf "$pointer->{$i}\n";
|
||
|
|
||
|
printf '${$pointer{$i}} is ';
|
||
|
printf "${$pointer{$i}} \n";
|
||
|
printf '${$pointer->{$i}} is ';
|
||
|
printf "${$pointer->{$i}}";
|