Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Getting error at 'if(exists..' condition that << Can't use string ("<?xml version='1.0' standalone='") as a HASH ref while "strict refs" in use >> . But same code works in most cases. Can anyone kindly suggest the reason for the issue?my $results = call_api(a,b); #call_api returns following xml which gets stored in $results. <?xml version='1.0' standalone='yes'?> <response> </one/two/value> ……… ……… <//one/two/value> <rc>0</rc> <region>AUS</region> <user>User1</user> </response> $num='/one/two'; $val='value'; if(exists $results{"$num"/"$value"}) { do something }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: XML header parsing error
by ~~David~~ (Hermit) on Jan 04, 2012 at 21:19 UTC | |
|
Re: XML header parsing error
by tobyink (Canon) on Jan 05, 2012 at 11:11 UTC |