my $ref_steps = &get_steps();
# 配列をデリファレンス @$ref_steps -->@{$ref_steps}
foreach my $sp (@$ref_steps) {
print sprintf("%s file %d 行\n", $sp->{file},$sp->{steps});
}
sub get_steps{
my @list; my $i=1;
for my $key ( qw(hoge hoge2 hoge3) ) {
push (@list, { file=>$key,steps=>$i });
$i++;
}
return \@list;
}
No comments:
Post a Comment