hash assign not working

2006-05-16 Thread Smith, Derek
My hash creations are not working as I expected: %hash = ( @mir, @mir2 ); Why? But do work at %hash = ( $mir[0], $mir2[0] ); Obviously I need the entire arrays and their associated key/value pairs, and have tried various methods unsuccessfully from Programming Perl CD such as array of hashes

RE: hash assign not working

2006-05-16 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Smith, Derek wrote: > My hash creations are not working as I expected: %hash = ( @mir, > @mir2 ); > > Why? > To populate a hash requires two fields: Key and data. What you are assuming is that it will take one from @mir and one from @mir2 which is a wrong assumption. Yes the second wor

Re: hash assign not working

2006-05-16 Thread Tom Phoenix
On 5/16/06, Smith, Derek <[EMAIL PROTECTED]> wrote: My hash creations are not working as I expected: %hash = ( @mir, @mir2 ); Why? Probably because that expression isn't a list of key-value pairs. If you're collecting @mir (a list of keys?) and @mir2 (a list of corresponding values?), no won

RE: hash assign not working

2006-05-16 Thread Charles K. Clarkson
Smith, Derek wrote: : My hash creations are not working as I expected: %hash = ( @mir, : @mir2 ); : : Why? Because nothing magical happens on the right hand side of the assignment. If I have a series of arrays over there perl flattens them into one list. It does not handle them special just

RE: hash assign not working

2006-05-16 Thread Charles K. Clarkson
Wagner, David --- Senior Programmer Analyst --- WGO wrote: : while ( @mir ) { : $hash{shift(@mir)} = shift(@mir2); :} We can also use a hash slice. my %hash; @[EMAIL PROTECTED] = @mir2; HTH, Charles K. Clarkson -- Mobile Homes Specialist Free Market Advocate Web Pr

Re: hash assign not working

2006-05-16 Thread Paul Johnson
On Tue, May 16, 2006 at 11:06:02AM -0700, Wagner, David --- Senior Programmer Analyst --- WGO wrote: > while ( @mir ) { > $hash{shift(@mir)} = shift(@mir2); > } @[EMAIL PROTECTED] = @mir2; -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net -- To unsubscribe, e-mai

RE: hash assign not working

2006-05-16 Thread Charles K. Clarkson
Charles K. Clarkson wrote: : It does not handle them special just because : there's a hash on the right hand side. Whoopsie! Should be left hand side not right. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: hash assign not working

2006-05-16 Thread Smith, Derek
From: Wagner, David --- Senior Programmer Analyst --- WGO [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 16, 2006 2:06 PM To: Smith, Derek; beginners@perl.org Subject: RE: hash assign not working Smith, Derek wrote: > My hash creations are not working as I expected: %hash = ( @mir, >