Re: vars as key/value in a hash

2001-11-09 Thread Dave Storrs
FYI, Tyler, the reason that this will do what you want is because you're original program wasn't doing what you thought. %stations = ( $names[0] => $names[1] ); This creates a list of two elements and assigns it to the hash named %stations. Therefore, $names[0] becomes the one and only

Re: vars as key/value in a hash

2001-11-08 Thread Christopher Solomon
On Thu, 8 Nov 2001, Christopher Solomon wrote: > On Thu, 8 Nov 2001, Tyler Cruickshank wrote: > > > I would like to create a hash based on data contained in a file. Can I not use a >variable as both the key and the value as shown below? When I print as shown I do >not get a value however if

Re: vars as key/value in a hash

2001-11-08 Thread Christopher Solomon
On Thu, 8 Nov 2001, Tyler Cruickshank wrote: > I would like to create a hash based on data contained in a file. Can I not use a >variable as both the key and the value as shown below? When I print as shown I do >not get a value however if I write the key as:alta_guard => $names[1]then

Re: vars as key/value in a hash

2001-11-08 Thread Brett W. McCoy
On Thu, 8 Nov 2001, Tyler Cruickshank wrote: > I would like to create a hash based on data contained in a file. Can > I not use a variable as both the key and the value as shown below? > When I print as shown I do not get a value however if I write the key > as: alta_guard => $names[1] then I g

vars as key/value in a hash

2001-11-08 Thread Tyler Cruickshank
I would like to create a hash based on data contained in a file. Can I not use a variable as both the key and the value as shown below? When I print as shown I do not get a value however if I write the key as:alta_guard => $names[1]then I get the correct value printed out. open(NAMES