http://www.perlmonks.org?node_id=964755

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.