in reply to Re^4: Putting Hash values into an array
in thread Putting Hash values into an array
Hello Raya4505, you wrote:
your line "if (exists my $DiagCodes{$_})"
But my line is:
if (exists $DiagCodes{$_})
— without the my! When you use my, you declare a new lexical variable. (And if the variable is not explicitly initialised in the declaration, it receives Perl’s default initialisation: undef if it’s a scalar, the empty list if it’s an array or hash.) So, remove the my and it should work correctly.
Here’s a useful reference: Coping with Scoping by Dominus.
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Putting Hash values into an array
by Raya4505 (Novice) on Mar 06, 2014 at 17:13 UTC | |
by Athanasius (Archbishop) on Mar 07, 2014 at 02:37 UTC | |
by Raya4505 (Novice) on Mar 07, 2014 at 21:16 UTC |