The problem is that the value in $thread can be duplicated therefore it will write over anything else contained there. That's the problem I am having.
-----Original Message----- From: James Edward Gray II [mailto:[EMAIL PROTECTED] Posted At: Monday, November 24, 2003 6:18 AM Posted To: Perl Conversation: Creating uniqueness in complex data structures Subject: Re: Creating uniqueness in complex data structures On Nov 23, 2003, at 6:36 PM, Paul Harwood wrote: > The log files I am parsing have threads (a T followed by several > alphanumeric numbers) associated with each line of text. I want to push > each value of $2 (which is a server name) into an anonymous array. > > This works fine in the following code. > > > if ($_ =~ /(T[0-9A-F]+) <MSM> SCTS\((.+)\)/) > { > my $thread = $1; > > push @{$server{$thread}}, $2 > unless grep $_ eq $2, @{$server{$thread}}; > > > } > > The problem I just realized is that sometimes a duplicate thread number > exists and it overwrites the information it previously had in it. How > do > I create a unique data structure that can prevent this from happening? I wouldn't think this could be happening IF the thread number already contained an array reference. James -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
