"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 @dirHash{$prefix}, $item; > } You can't push onto a hash. The syntax @dirHash{$prefix} is a hash slice. Q.E.D. I'm not quite sure what you're trying to do. Is it that you may have multiple items per prefix, and you want them all in the same hash element? If so, what you want is more like the following. Caution - cold code follows: foreach my $item (@dirArray) { $prefix = substr ($item, 0, 4); push @{$dirHash{$prefix}}, $item; } Tom Wyant This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs