Nine things caught my eye in the 10s I spent looking at your node:

1)
$script_name[((scalar(@script_name)) - 1)]
can be shortened to
$script_name[@script_name - 1]
and
$script_name[$#script_name]
and
$script_name[-1]

2) Why use an array for script_name? The following will do:
my $script_name = (split m!\\!, $0)[-1];

3) Windows also accepts "/" as a path seperator. Fix:
my $script_name = (split m![\\/]!, $0)[-1];
or better yet, the portable
use File::Spec;
my $script_name = (File::Spec->splitpath($0))[2];

4) You use prototypes. Prototypes are discouraged; they should only be used when they are necessary.

4)a) They are not necessary for WMIMain. You're even using the wrong prototype. The following will not work:

WMIMain(@ARGV); sub WMIMain(\@) { my $computer = $_[0]; my $action = $_[1]; my $rvalue = $_[2]; my $kvalue = $_[3]; ...

4) b) You are using prototypes on methods. They are not definitely not necessary there either, since prototypes don't even work (are ignored) when functions are called as methods.

5) You're using user-provided, unvalidated, unescaped value ($kvalue and others) in a SQL commands.

6) I think
scalar(Win32::OLE::in($computers))
should be
scalar(@{Win32::OLE::in($computers)})

7)
scalar(@{Win32::OLE::in($computers)}) lt "1"
won't do what you expect. Use
scalar(@{Win32::OLE::in($computers)}) < 1
or just
@{Win32::OLE::in($computers)} < 1

Same for eq "1" (== 1) and gt "1" (> 1).

Use eq/ne/lt/gt for string comparisons. Use ==/!=/</> for numerical comparisons. This is documented in perlop.

8)
Win32::OLE::in($computers)
can be simplified to
in $computers
if you do
use Win32::OLE qw( in );
at the top.

Update: I spent another 10s looking at the code, and documented the additional problems I found. It seems you have problems with Perl, not just WMI. Do you have a specific question you'd like to have answered?


In reply to Re: How to monitor a file located on the remote host(win2k)? by ikegami
in thread How to monitor a file located on the remote host(win2k)? by ioiioi

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.