I'll test and explain if nobody else does shortly.
Update: There's nothing technically wrong with your code, and it should work (as the Monks who tested it below can show). However, it isn't the most idiomatic Perl out there. Right off the bat, although perl allows whitespace nearly anywhere, it's clearer if you keep your delimiters together: ${ $my_data_ref }{ names }
What this does:
${ $my_data_ref } { names }is it dereferences $my_data_ref hash reference, and converts (actually it forces) the value(s) of its names key into a scalar value. It is equivalent to the more idiomatic:
my $scalar = $my_data_ref->{names}Both do the same thing, but one is a bit more understandable at-a-glance, so long as the left-hand side (or within another line or two) makes it clear what type (scalar or list) you're pulling out.
-stevieb
In reply to Re: Hash Ref Error
by stevieb
in thread Hash Ref Error
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |