programming-examples/perl/Hash/Using the arrow operator.pl
2019-11-15 12:59:38 +01:00

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}}";