SPUG: I GOT AN ANSWER: Odd number of elements in hash assignment at YYY Y line XX

Nord, Chris chris.nord at attws.com
Wed Dec 19 20:17:46 CST 2001


Thanks all for the replies; I found the error in my ways.

CRN

> -----Original Message-----
> From:	Nord, Chris 
> Sent:	Wednesday, December 19, 2001 5:39 PM
> To:	'spug list'
> Subject:	spug: Odd number of elements in hash assignment at YYYY line
> XX
> 
> 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