in reply to PERL Warnings

Looking at the source for that module, it appears to do the following:
$^W = 1;
Which is the same as putting -w in your hash bang line. Basically, it turns on warnings. Right after the 'use XML::Mini::Document;' you could put:
$^W = 0;

The other option is to fix the warnings, assuming they are coming from your code. You should always work with use strict; and use warnings; on. If your script is barking, it's probably for a reason.

Good luck.

Replies are listed 'Best First'.
Re^2: PERL Warnings
by Anonymous Monk on Nov 21, 2005 at 21:10 UTC
    ok, im working through some of the warnings, and i have a question. is this not valid:
    my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime +(time); my $dateTime = $hour,":",$min,":",$sec," ",$mday,"/",$mon+1,"/",$y +ear+1900,"";
    when i run my program, i get this for output:
    Useless use of a constant in void context at C:\Perl\test\Dev\AutoSI\autoSI.pl line 98.
    Useless use of private variable in void context at C:\Perl\test\Dev\AutoSI\autoSI.pl line 98.
    Useless use of a constant in void context at C:\Perl\test\Dev\AutoSI\autoSI.pl line 98.
    Useless use of private variable in void context at C:\Perl\test\Dev\AutoSI\autoSI.pl line 98.
    Useless use of a constant in void context at C:\Perl\test\Dev\AutoSI\autoSI.pl line 98.
    Useless use of private variable in void context at C:\Perl\test\Dev\AutoSI\autoSI.pl line 98.
    Useless use of a constant in void context at C:\Perl\test\Dev\AutoSI\autoSI.pl line 98.
    Useless use of addition (+) in void context at C:\Perl\test\Dev\AutoSI\autoSI.pl line 98.
    Useless use of a constant in void context at C:\Perl\test\Dev\AutoSI\autoSI.pl line 98.
    Useless use of addition (+) in void context at C:\Perl\test\Dev\AutoSI\autoSI.pl line 98.
    Useless use of a constant in void context at C:\Perl\test\Dev\AutoSI\autoSI.pl line 98.
    anyhelp would be great. thanks

      You should probably log back in when you post a follow-up.

      Anyway, no, it's not valid. Try changing all the commas to dots:

      my $dateTime = $hour.":".$min,":".$sec," ".$mday."/".$mon+1."/".$ye +ar+1900."";
      Or you can change $dateTime to @dateTime, and put the whole RHS in parenthesis:
      my @dateTime = ($hour,":",$min,":",$sec," ",$mday,"/",$mon+1,"/",$y +ear+1900,"");
      Of course, doing that changes how you use it as well. I'm guessing you want the first one. Note that you may also just find it easier to use sprintf:
      my $dateTime = sprintf "%02d:%02d:%02d %02d/%02d/%d", $hour, $min, $sec, $mday, $mon+1, $year+1900;

      PS - I'm not sure why you have that ending empty string - you should be able to get rid of it.

      Well, run it and see if $dateTime is set to what you expect. On my system, it's set to 16, which is probably not what you expect. The comma seperates arguments to a function, or if not used in a function call, executes all of the statements listed. In this case, it's first executing:
      my $dateTime = $hour
      then
      ":"
      then
      $min

      Neither : nor $min will do anything, so Perl complains this probably isn't what you wanted.

      Probably you meant to use the dot operator (.) to concatenate these together as strings, or else use the strings as arguments to join.