Re: Hash of arrays

2003-04-03 Thread Thomas R Wyant_III
Daniel Gross [EMAIL PROTECTED] writes: I running into problems again: This time I'd like to fill a hash with arrays, however, the following push command generates a syntax error. Any idea why My %dirHash = (); foreach my $item(@dirArray) { $prefix = substr($item, 0,4); push

RE: Hash of arrays

2003-04-03 Thread Daniel Gross
. Discenza [mailto:[EMAIL PROTECTED] Sent: Thursday, April 03, 2003 8:36 AM To: Daniel Gross; [EMAIL PROTECTED] Subject: RE: Hash of arrays Daniel Gross wrote, on Thursday, April 03, 2003 08:34 : I running into problems again: This time I'd like to fill a hash with : arrays, however, the following push

Re: Hash of arrays

2003-04-03 Thread Alan Dickey
Daniel Gross wrote: Seems to work. It doesn't generate a syntax error. So, value elements within a hash are always references? no, but they are always scalars :) BTW, in your opinion would this also work when $dirHash{$prefix} is undefined (i.e. when no key was defined yet?) perl has a

RE: Hash of arrays

2003-04-03 Thread Joseph P. Discenza
Daniel Gross wrote, on Thursday, April 03, 2003 08:45 : push @{$dirHash{$prefix}}, $item; : Seems to work. It doesn't generate a syntax error. So, value elements : within a hash are always references? : : BTW, in your opinion would this also work when $dirHash{$prefix} is : undefined (i.e.

creating array reference to one array of a hash of arrays

2002-07-12 Thread Jares, Howard M
# I have a program that gets a hash from an API call. # the format of the hash is that each key corresponds to an # array. The following code snippet illustrates the data: $href-{One} = [1,2,3,4]; print ref($href).\n; print ref($href-{One}).\n; # I would like to simplify the syntax to use a

RE: hash of arrays

2002-01-16 Thread Peter Eisengrein
: Wednesday, January 16, 2002 10:43 To: 'Peter Eisengrein'; Perl-Win32-Users Mailing List (E-mail) Subject: RE: hash of arrays This is what you want... foreach my $dn (keys %features) { my @features = @{$features{$dn}}; print $dn|; foreach (@features

RE: hash of arrays

2002-01-16 Thread Peter Eisengrein
BINGO! Thanks Rob. -Original Message- From: Hanson, Robert [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 16, 2002 10:58 To: 'Peter Eisengrein' Subject: RE: hash of arrays Hmmm... If $features{$dn} is a reference to an array you dereference it like

Re: hash of arrays

2002-01-16 Thread dolljunkie
- Original Message - From: Peter Eisengrein [EMAIL PROTECTED] That just adds a field to my output, like so: 7943641|ARRAY(0x1b9efb8)|| Perhaps I'm contructing it wrong? I'm doing it like this... @_=$features{$dn}; push(@_,$line[1]); $features{$dn}=\@_; That's kind