$_xmlData holds the data returned from an XML::Simple::XMLin call, Bucket being the key that references an array of all these things called buckets. Dumper is a function in Data (not sure if it's a commonly used tool, but it seems to print out arrays and hashes nicely). Trying to handle this with a foreach loop, I put all that data into @bucketList. The dump shows that it is all ok. The problem is with my foreach variable, $bucket. I would think that it would be set to each element of @bucketList sequentially. According to the dump, it's actually set to the entire array. What am I doing wrong? as requested, here are snippets of the dumps: bucketList:my @bucketList = $_xmlData->{Bucket}; open(DEBUG, ">bucketList.txt"); print DEBUG Dumper(@bucketList); close(DEBUG); foreach my $bucket ( @bucketList ) { open(DEBUG, ">bucket.txt"); print DEBUG Dumper($bucket); close(DEBUG); }
$VAR1 = [ { 'ExeVersion' => NDA_BLOCKED, 'ModuleVersion' => NDA_BLOCKED, 'ResponseStatus' => NDA_BLOCKED, 'ExeName' => NDA_BLOCKED, 'Priority' => NDA_BLOCKED, 'TotalHits' => NDA_BLOCKED, 'ResponseURL' => NDA_BLOCKED, 'ModuleName' => NDA_BLOCKED, 'BucketID' => NDA_BLOCKED' }, { 'ExeVersion' => NDA_BLOCKED, 'ModuleVersion' => NDA_BLOCKED, 'ResponseStatus' => NDA_BLOCKED, 'ExeName' => NDA_BLOCKED, 'Priority' => NDA_BLOCKED, 'TotalHits' => NDA_BLOCKED, 'ResponseURL' => NDA_BLOCKED, 'ModuleName' => NDA_BLOCKED, 'BucketID' => NDA_BLOCKED' }, { 'ExeVersion' => NDA_BLOCKED, 'ModuleVersion' => NDA_BLOCKED, 'ResponseStatus' => NDA_BLOCKED, 'ExeName' => NDA_BLOCKED, 'Priority' => NDA_BLOCKED, 'TotalHits' => NDA_BLOCKED, 'ResponseURL' => NDA_BLOCKED, 'ModuleName' => NDA_BLOCKED, 'BucketID' => NDA_BLOCKED' }]
$VAR1 = [ { 'ExeVersion' => NDA_BLOCKED, 'ModuleVersion' => NDA_BLOCKED, 'ResponseStatus' => NDA_BLOCKED, 'ExeName' => NDA_BLOCKED, 'Priority' => NDA_BLOCKED, 'TotalHits' => NDA_BLOCKED, 'ResponseURL' => NDA_BLOCKED, 'ModuleName' => NDA_BLOCKED, 'BucketID' => NDA_BLOCKED' }, { 'ExeVersion' => NDA_BLOCKED, 'ModuleVersion' => NDA_BLOCKED, 'ResponseStatus' => NDA_BLOCKED, 'ExeName' => NDA_BLOCKED, 'Priority' => NDA_BLOCKED, 'TotalHits' => NDA_BLOCKED, 'ResponseURL' => NDA_BLOCKED, 'ModuleName' => NDA_BLOCKED, 'BucketID' => NDA_BLOCKED' }, { 'ExeVersion' => NDA_BLOCKED, 'ModuleVersion' => NDA_BLOCKED, 'ResponseStatus' => NDA_BLOCKED, 'ExeName' => NDA_BLOCKED, 'Priority' => NDA_BLOCKED, 'TotalHits' => NDA_BLOCKED, 'ResponseURL' => NDA_BLOCKED, 'ModuleName' => NDA_BLOCKED, 'BucketID' => NDA_BLOCKED' }]
In reply to foreach not doing what I expect it to be doing by skorman00
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |