Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

How to retrieve right info from list of anonymous hashes

by gepebril69 (Scribe)
on Apr 12, 2012 at 13:33 UTC ( #964755=perlquestion: print w/ replies, xml ) Need Help??
gepebril69 has asked for the wisdom of the Perl Monks concerning the following question:

Hi there,

I want to use Win32::Process::Info to get information if a PID of a process is in use or not, without using the TASKLIST command in Windows which results depends on the language of your OS :S

I've tried the following code, which gave me part of the answer of the puzzle

use Win32::Process::Info; $pi = Win32::Process::Info->new (); $MyPID = $$; @info = $pi->GetProcInfo ($$);
HASH(0x2954c14) which seems to be a list of anonymous hashes The module in CPAN don't give an example of how to do this and Googling for info to retrieve info from such a construction, was not successful. I understand the concept of hashes, but not to this deep level. Can somebody help me out.

Replies are listed 'Best First'.
Re: How to retrieve right info from list of anonymous hashes
by moritz (Cardinal) on Apr 12, 2012 at 13:42 UTC
Re: How to retrieve right info from list of anonymous hashes
by JavaFan (Canon) on Apr 12, 2012 at 13:45 UTC
    The module in CPAN don't give an example of how to do this
    Well, it would be too much to expect from every CPAN module that uses hashes to explain to the user to access a hash.

    Try something like:

    foreach my $process (@info) { while (my ($k, $v) = each %$process) { print "$k => $v\n"; } print "\n"; }
    Or use your favourite serializer.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://964755]
Approved by moritz
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (7)
As of 2016-06-28 22:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred method of making French fries (chips) is in a ...











    Results (364 votes). Check out past polls.