#!/usr/bin/perl use Win32; use Win32::Process::Info; my $exe = "notepad.exe"; # Name der Processdatei my $pi = Win32::Process::Info->new(); check_process(); print $returncode; #while ($returncode eq "running") # { check_process(); #   print $returncode; # }   sub check_process { foreach my $hashref ($pi->GetProcInfo()) {   if (lc($hashref->{Name}) eq $exe)   {      #print "Process: $hashref->{Name}\n";      $returncode = "running";   }  }  if ($returncode eq "running")  { return $returncode;  }  else { $returncode="not running"; return $returncode;        } }