Perl Error Bad Index While Coercing Array Into Hash
Q&A Tutorials Poetry RecentThreads NewestNodes Donate What'sNew on Jun 08, 2007 at 20:09UTC ( #620080=perlquestion: print w/replies, xml ) Need Help?? Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question: My code print Dumper ($self->result->{Abcd}); print "\n Platform ="; print Dumper ($self->result->{Abcd}->{Platfor +m}); print "\n abcdname ="; print Dumper ($self->result->{Abcd}->{AbcdNam +e}); [download] output with error $VAR1 = [ { 'Platform' => '12000', 'AbcdName' => 'slhrno1', 'DedicatedOption' => '-1', 'ShortName' => 'BRYN1', 'AFlag' => 'N', 'AbcdId' => '47358', 'Vendor' => 'MICROSOFT', 'Type' => '21', 'AliasName' => 'stlt', 'ExportVersion' => 'US' } ]; Platform =$VAR1 = undef; abcdname =Bad index while coercing array into hash at xxx.pm line 33 [download] I dont see 'AbcdName' as array, also 'Platform' got value of 12000 but output shows undef.... any help? Code tags added by GrandFatherComment on Bad index while coercing array into hashSelect or Download Code Replies are listed 'Best First'. Re: Bad index while coercing array into hash by kwaping (Priest) on Jun 08, 2007 at 22:58UTC Your $self->result->{Abcd} is actually an array of hashrefs. Try printing $self->result->{Abcd}[0]{Platform} instead. --- It's all fine and dandy until someone has to look at the code. [reply][d/l][select] Re^2: Bad index while coercing array into hash by Anonymous Monk on Jun 11, 2007 at 00:03UTC thanks kwaping, its working...[reply] Re^3: Bad index while coercing array into hash by Anonymous Monk on Aug 25, 2014 at 12:45UTC Can someone please help me on this : The output of the custom field when run via api query: "customfield_11872": [ { "self": "https://localhost.com:8080/rest/api/2/version/35372", "id": "35372", "description": "Null version. May be deleted after other conforming versions are created", "name": "0.0.0.0", "archived": false, "released": false } the command that i used is shown below: my $decoded_json = decode_json($result); $jira_found_in_release = "$decoded_json->{'fields'}{'customfield_11872'}{'name'}; When the customfield name value is null, I do not get any error but when the name field contains value suc
hashEmpty tag Page 1 of 1 New Topic/Question Reply 3 Replies - 9015 Views - Last Post: 18 September 2007 - 01:09 AM #1 eXceed69 "Super Sentai Knight Of DawN" Reputation: 8 Posts: 688 Joined: 12-November 06 Bad index while coercing array into hash Posted 16 August 2007 - 02:03 PM I’m getting the following error when running a script using an anonymous array of hashes. "Bad index while coercing array into hash", I encounter on part this part of the code. Which the only purpose was to gets the data to an xml files and assign it to a variable. If I passed an empty data it would error out just like this is that possible or any idea. $rejXTags = $data->{getINFO}->{SUBJ}->{BODY}->{CONCERN}->{ERROR_INFO}->{ERROR_DESC}; Is This A Good Question/Topic? 0 Back to top MultiQuote Quote http://www.perlmonks.org/?node_id=620080 + Reply Replies To: Bad index while coercing array into hash #2 Martyr2 Programming Theoretician Reputation: 4954 Posts: 13,366 Joined: 18-April 07 Re: Bad index while coercing array into hash Posted 16 August 2007 - 02:36 PM Perhaps if you use Data::Dumper on the elements there you can get a better idea what is going on. You can also check out the web link below which is somewhat similar to what you are doing and look at how they attacked it. Hope this http://www.dreamincode.net/forums/topic/31783-bad-index-while-coercing-array-into-hash/ works for you. Coercing array into hash error, using data dumper to help pinpoint problem Was This Post Helpful? 0 Back to top MultiQuote Quote + Reply #3 KevinADC D.I.C Regular Reputation: 27 Posts: 401 Joined: 23-January 07 Re: Bad index while coercing array into hash Posted 17 August 2007 - 12:43 PM Are you sure it's not an array of hashes of arrays? Was This Post Helpful? 0 Back to top MultiQuote Quote + Reply #4 eXceed69 "Super Sentai Knight Of DawN" Reputation: 8 Posts: 688 Joined: 12-November 06 Re: Bad index while coercing array into hash Posted 18 September 2007 - 01:09 AM It's a array of hash in a array Was This Post Helpful? 0 Back to top MultiQuote Quote + Reply ← Previous Topic Perl Next Topic → Page 1 of 1 Related TopicsbetaWhile Loop In Perl - Perl Newbie Dart - Any Thoughts Yet? PERL HELP: List Sorter In Alphabetical Order - This Is A Program Written In Perl Project Euler Problems - Math/programming Challenges Breaking Up An Array Using "use" Doesn't Import Variables Implicitly How To Deal With A Poor Team Leader And A Tester Manager From Hell? Your Opinion On The Best Language For Beginners Perl Is The Perfect Language? - Is It The Book Or Is It The Language? How Often Do You Use Recursion? General Discussion Caffeine Lounge Corner Cubicle Student Campus Software Development Industry News Introduce Yourself Nightmare.In.Code Programming Help C and C++ VB.NET Java
by: [ date ] [ https://lists.katipo.co.nz/public/koha/2008-April/013651.html thread ] [ subject ] [ author ] (Gentoo Linux 2.6.24, Apache 2.0.61, MySQL 5.0.56, Perl 5.8.8) Hi, all. Having upgraded my Koha with the one-line fix that was the source of my last problem, I'm now having this problem: When perl error I try to add a new biblio, I get this immediately after clicking "Save": ------------------------------- The following fatal error has occurred: Bad index while coercing array into hash at /usr/share/koha/lib/C4/Biblio.pm line 2267. Apache Server version: Apache/2.0.61 Server built: Dec 5 2007 perl error bad 16:53:30 Koha 3.00.00.069 Koha DB 3.0000069 MySQL mysql Ver 14.12 Distrib 5.0.56, for pc-linux-gnu (i686) using readline 5.2 OS Linux www 2.6.24-gentoo-r5 #1 SMP Wed Apr 9 22:16:10 EDT 2008 i686 Intel(R) Pentium(R) 4 CPU 2.80GHz GenuineIntel GNU/Linux Perl 5.008008 ------------------------------- This is a Koha snapshot as of last night. I didn't see any obvious changes in Biblio.pm or addbiblio.pl that would account for this error. Does anyone have any ideas what the problem here might be? Thanks to anyone who can help! Previous message: [Koha] internal server error Next message: [Koha] Bad index while coercing array into hash Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] More information about the Koha mailing list