J
Justin C
Sometimes I do this:
sub foo {
my %h = (
k1 => 1,
k2 => 2,
);
return \%h;
}
Other times I do this:
sub bar {
my $h = {
k1 => 1,
k2 => 2,
};
return $h;
}
Is there any difference between $x and $y if I:
my $x = foo();
my $y = bar();
Using YAML qw/Dump/ says not, but is there anything I should be aware
of when using either form? Is there a "best practice" that says use
one of them over the other?
Justin.
sub foo {
my %h = (
k1 => 1,
k2 => 2,
);
return \%h;
}
Other times I do this:
sub bar {
my $h = {
k1 => 1,
k2 => 2,
};
return $h;
}
Is there any difference between $x and $y if I:
my $x = foo();
my $y = bar();
Using YAML qw/Dump/ says not, but is there anything I should be aware
of when using either form? Is there a "best practice" that says use
one of them over the other?
Justin.