SPUG: spug: Odd number of elements in hash assignment at YYYY line XX

Nord, Chris chris.nord at attws.com
Wed Dec 19 19:39:24 CST 2001


Question on the below code.  I get a PERL message, "Odd number of elements
in hash assignment at nlerg line XX".  The results of the map get populated
as keys in %hash.  Why the "Odd number..." error?

 @array_x = map m|some_pattern|, at array_y;
 %hash = @array_x;

 foreach (keys %hash){
  print "$_\n";
 }

Odd number of elements in hash assignment at nlerg line XX
line XX is %hash = @array_x;

Also tried $hash{map m|some_pattern|, at array_y} = ''; but the results of the
map do not generate a key list in the hash.

Chris Nord

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
     Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/





More information about the spug-list mailing list