For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > March 2005 > Re: Question: Array of Hashes









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Question: Array of Hashes
Offer Kaye

2005-03-31, 3:56 pm

On Thu, 31 Mar 2005 14:40:47 +0200, Olivier, Wim W wrote:
> Hi all,
>
> I have the following code below which I need to modify a bit.
>
> The script currently lists the key/value pairs for all processes in the
> system.
> What I need to achieve is for it to only list the key/value pairs for
> processes of which the "Description" key is of a certain ASCII value, say
> "analytics.exe".
>


Untested, but here goes:
foreach my $info (@info)
{
if ($info->{'Description'} eq "analytics.exe")
{
foreach ('ProcessId', 'Description', 'ThreadCount')
{
print "$_ = ", $info->{$_} || '', "\n";
}
print "\n";
}
}

Hope this helps,
--
Offer Kaye
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com