On Oct 19, 2:04 pm, [EMAIL PROTECTED] (Joseph L. Casale)
wrote:
> My whole project got too messy so I decided to use an existing XML file to 
> load in all the needed input I would require.
>
> I have the following code but fail to access to data in $workspace.
>
> my $workspace = XMLin($ARGV[0], forcearray => 1);
> print Dumper($workspace);
> print "$workspace->{TextHere}->{content}->[0]\n";
>
> The last print gives an error. The output from dumper is similar to this:
>
> $VAR1 = {
> 'TextHere' => [
>                                        {
>                          'content' => 'C:\\Data\\asd\\asd\\2008\\ghjk',
>                          'xml:space' => 'text'
>                        }
>                      ]
>
> };
>
> All of the work I was previously doing is listed in here, I just avoided 
> extracting it as I knew it would be hard, I am still very green in Perl :)
>
> Can someone point out the syntax to access content (I need that path) as I 
> want to use this variable elsewhere.

You've got {content} and [0] reversed.  TextHere is a key whose
corresponding value is an array, and the first element of that array
is a hash which contains a 'content' key.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to