Good point. I should be a little more imaginative. Sometimes making up meaningful variable and function names is the hardest part of writing code.
Another thing I found about the references, the order of the parameters matter. If I pass the array ref first and the hash ref second, the foreach(@$aref) loop walks right over the hash ref and I get information at the end of @leftovers "main::hash". --Chuck > -----Original Message----- > From: Dave Storrs [mailto:[EMAIL PROTECTED]] > Sent: Friday, November 16, 2001 11:38 AM > To: '[EMAIL PROTECTED]' > Subject: RE: Populating a referenced hash > > > > This may or may not solve your problem, but.... > > Name your sub something other than 'ref'. Ref is a reserved > word in Perl. > > (perldoc -f ref for details on what it does) > > Dave > > > > > ----------arg.pl--------------- > > > > #/usr/plx/bin/perl -w > > > > > > > > use strict; > > > > > > > > sub ref > > > > { > > > > my ($href, $aref) =@_; > > > > my (@leftovers); > > > > > > > > foreach (@$aref) { > > > > chomp; > > > > if (/^UserID\s+:\s+(\d+)/) { > > > > ${$href}{'UserID'} = $1; > > > > } elsif (/^SupportGroup\s+:\s+(\d+)/) { > > > > ${$href}{'SupportGroup'} = $1; > > > > } elsif (/^Assigned To\s+:\s+(\d+)/) { > > > > ${$href}{'AssignTo'} = $1; > > > > } elsif (/^DateOpened\s+:\s+(\d+)/) { > > > > ${$href}{'DateOpened'} = $1; > > > > } else { > > > > push(@leftovers, "$_\n"); > > > > } > > > > } > > > > return(@leftovers); > > > > } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]