what is wrong here. nothing is printing to the file, list.txt
#use warnings; #use DBI; use Win32; use Win32::OLE qw (in); open(HLOG,">c:/temp/logf.txt") || die " Open Log_file: $!"; open(HLIST,">C:/temp/list.txt") || die " Open list.txt: $!"; #my $dbh = DBI->connect('dbi:DBI:'); while(<>) { chomp($_); @a = `ping -n 1 $_`; print "for $_:"; if ("@a" =~ /Request timed out/i || "@a" =~ /could not find host/i + ){ print "<<<<not Alive>>>>>\n"; #TODO #spit it to non-alive txt file #close file print(HLOG); } else { print "::: Alive\n"; my $Class = "WinMgmts://$_"; my $Wmi = Win32::OLE->GetObject ($Class); if ($Wmi) { my %Vars = $Wmi->ExecQuery("SELECT * FROM $Win32_Environme +nt"); print $Vars; foreach (keys %Vars) { print HLIST $Vars{$_} ."\n"; } } else { print "NO idea"; } #TODO: if alive, check if cadmap exists, if yes, spit the var= +value pair to a log.txt file. } } close (HLOG) || die "Close: $!"; close (HLIST) || die "Close:$!";

In reply to Re^4: Perl $ENV hash by kingjamesid
in thread Perl $ENV hash by kingjamesid

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.