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

I am getting a warning, and I need some advice on it...
Parameter format not correct - "Perl".
The line that I think that is producing this is...
while ($x != $limit) { foreach $x (@icpList) { health($x); secureTelnetCommand($x); pstswlog($x); }
any advise would be greatly appreciated...

Replies are listed 'Best First'.
Re: Perl Warning Help
by davorg (Chancellor) on Nov 28, 2005 at 15:50 UTC

    That's not a Perl warning message. It must be generated by some external program that you are calling from one of those functions.

    Googling for the phrase "Parameter format not correct" returns a number of hits and glancing at the first few would seem to indicate that it's a Windows error message of some sort.

    --
    <http://dave.org.uk>

    "The first rule of Perl club is you do not talk about Perl club."
    -- Chip Salzenberg

Re: Perl Warning Help
by tirwhan (Abbot) on Nov 28, 2005 at 15:50 UTC

    We cannot know what is causing this warning, because we don't know what the subroutines you are calling("health","secureTelnetCommand","pstsqlog") do. The error message sounds like a message from the find utility though, so maybe you are calling that somewhere?

    To find your error cause more accurately, insert warnings in between the subroutine calls, like

    while ($x != $limit) { foreach $x (@icpList) { warn "start loop"; health($x); warn "health executed"; secureTelnetCommand($x); warn "secureTelnetCommand executed"; pstswlog($x); warn "pstswlog executed"; }

    And take a closer look at the subroutine during which the warning shows up.

    Or run the program in the debugger (perl -d script.pl)


    Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -- Brian W. Kernighan
Re: Perl Warning Help
by ikegami (Patriarch) on Nov 28, 2005 at 15:51 UTC

    I'm not sure what that error means -- add use diagnostics for more details if it's a Perl error -- but I doubt the error is where you say it is since the word "Perl" does not appear in that snippet.

    By the way, why do you use $x outside the foreach loop and as the variable for the foreach loop? The outer $x is not affected by the foreach, but it's very confusing (and therefore hard to read and to maintain).

    my $x = '!'; foreach $x (qw( a b c )) { print("$x\n"); } print("$x\n");

    outputs

    a b c !
Re: Perl Warning Help
by Arcane (Initiate) on Nov 28, 2005 at 16:03 UTC
    the problem is in the health routine. I am trying to delete a file if it exist with
    if (-e $fn) { system("del $fn"); }
    $fn is defined as
    my $dir = getcwd; my $fn=$dir."\\Logs\\temp.log";
    is this a bad way to delete a file if it exists...
    i have also change the loop to use new vars so i am not using $x twice, brain fart there...

      Try unlink

      unlink $fn;

      Addendum: Does $fn ever have spaces or forward slashes in it? If so, I'd guess that's what's causing your problems handing it off to system.

      -xdg

      Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

        that worked....thanks for your help

      Well, I don't do Windows, but I'm pretty sure it would be better to use the inbuilt unlink command instead of system.

      if (-e $fn) { unlink $fn or die "Can't remove $fn"; }

      Note that this will not work on directories (use rmdir for that).


      Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -- Brian W. Kernighan