nisha has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks, I have a small program as below; in the program below which makes use of the win32::Process::info module, i am unable to access the hash it returns. Basically i did not understand from the module on how to access these hash references. Please help me with this.
#!/usr/bin/perl use Win32::Process::Info; $pi = Win32::Process::Info->new ("172.16.222.173", "WMI"); @pids = $pi->ListPids (); # Get all known PIDs @info = $pi->GetProcInfo (); # Get the max foreach $i (@pids) { print $i, "\n"; @proc = $pi->GetProcInfo($i); print @proc , "\n"; }
Thanks, Nisha

2006-06-07 Retitled by holli, as per Monastery guidelines
Original title: 'Win32::Process::Info'

Replies are listed 'Best First'.
Re: Using the results from Win32::Process::Info
by prasadbabu (Prior) on Jun 07, 2006 at 09:31 UTC

    Hi nisha,

    You can use Data::Dumper.

    use strict; use warnings; use Win32::Process::Info; use Data::Dumper; my $pi = Win32::Process::Info->new ("172.16.4.47", "WMI"); my @pi = $pi->ListPids (); # Get all known PIDs print Dumper $pi->GetProcInfo ($_) for @pi; #Get the info
    Also take a look at perlref about dereference.
    updated

    Prasad

Re: Using the results from Win32::Process::Info
by planetscape (Chancellor) on Jun 07, 2006 at 16:45 UTC
Re: Using the results from Win32::Process::Info
by jesuashok (Curate) on Jun 07, 2006 at 09:27 UTC
    Hi

    If you are familiar with reference, try using Data::Dumper

    use Data::Dumper; @pids = $pi->ListPids (); # Get all known PIDs @info = $pi->GetProcInfo (); # Get the max print Dumper [ @pids ]; print Dumper [ @info ];
    The above code will give a clear picture, then you can access it from the datastructure it shows.

    "Keep pouring your ideas"