Your immediate problem is that perl interprets your %{ as a hash slice (see http://docstore.mik.ua/orelly/perl/learn/ch05_05.htm for a small example)
Your larger problem is that you want to use a technique that is a relict from perl4 days and only (if at all) suitable for quick hacks
Instead of using
use multidimensional hashesmy %{"platform_$site"}; ${"platform_$site"}{"thingy"}= 5; foreach my $x ( keys %{"platform_$site"}) { ...
my %platform; $platform{$site}{"thingy"}= 5; foreach my $x ( keys %{$platform{$site}}) { ...
You can use the same technique for your arrays as well, i.e. use a so called HashOfArrays:
push @{$platform{$site}}, 1,2; $platform{$site}[5]= 5; foreach my $x ( @{$platform{$site}}) { ..
PS: I also notice you don't use 'use warnings;' and 'use strict;' at the beginning of your script. It is highly advisable to include those two lines. Avoids many bug finding sessions later.
In reply to Re: syntax for hashes with variable in name
by jethro
in thread syntax for hashes with variable in name
by equick
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |