Anonymous Hash

From: quartet (travisq_at_gmail.com)
Date: 01/28/05


Date: 28 Jan 2005 06:30:55 -0800

I am using the following script to output the data structure below:

#!/usr/bin/perl -wT

use Data::Dumper;
use FindBin qw($Bin);
use XML::Simple;
use strict;

my ($data,$xml,$VAR1);
#$xml = new XML::Simple (KeyAttr=>'sku', forcearray=>'1');
$xml = new XML::Simple (forcearray=>'1');
$data = $xml->XMLin("$Bin/some.xml");
print Dumper($data);
print "\n";

output:

$VAR1 = {
'JOB' => [
{
'MAXRUNS' => '0',
'APPLICATION' => 'MANUGISTICST',
'MAXDAYS' => '0',
'MAR' => '1',
'TASKTYPE' => 'Job',
'FEB' => '1',
'NOV' => '1',
'INTERVAL' => '0M',
'DATACENTER' => 'EM61',
'CONFIRM' => '0',
'MAY' => '1',
'TIMETO' => '0105',
'OCT' => '1',
'QUANTITATIVE' => [
{
'QUANT' => '1',
'NAME' => 'SYSTEM'
},
{
'QUANT' => '1',

Can someone tell me why its neccessary to use '%$' for referncing the
hash, I want to access all the values in the anonymous hash.



Relevant Pages

  • Re: Accessing a hash whose name is constructed
    ... does the trick as does: ... however, under "use strict", this fails, since %hello isn't declared ... If I do put a my in front of the %hello declaration, ... Why not use an anonymous hash? ...
    (comp.lang.perl.misc)
  • Re: How do I loop through anonymous hash?
    ... > Basically I've got an anonymous hash that I want to loop through, ... > use strict; ... > use warnings; ...
    (comp.lang.perl.misc)