Use of uninitialized value in concatenation

Discussion in 'Perl' started by smartins68, Jun 9, 2004.

  1. smartins68

    smartins68 Guest

    I have a Perl code and I am receiving the error below and I am strugling
    with that. Can anybody help me that? I am a new perl person:

    $ ./CheckProvActivity.pl 2004 06 07
    Use of uninitialized value in concatenation (.) or string at
    ../CheckProvActivity.pl line 22.
    Use of uninitialized value in concatenation (.) or string at
    ../CheckProvActivity.pl line 22.
    Use of uninitialized value in concatenation (.) or string at
    ../CheckProvActivity.pl line 24.
    Use of uninitialized value in concatenation (.) or string at
    ../CheckProvActivity.pl line 24.
    Cannot open /apps/log/opwv/provisioning/Proxy_07.log: No such file or
    directory

    This is part of my code:

    #!/usr/local/bin/perl -w

    if (($ARGV[0] eq "") && ($ARGV[1] eq "") && ($ARGV[2] eq ""))
    {
    ($yday,$ymonth,$yyear) = (localtime(time() - ( 24 * 60 * 60 )))[3,4,5];
    $WDay= sprintf("%02d",$yday);
    $wMon= sprintf("%02d",$ymonth);
    $WYear= sprintf("%04d",$yyear+1900);
    }
    elsif (($ARGV[2] eq "") && ($ARGV[0] ne ""))
    {
    print "\n\nThis script expects the following arguments YYYY MM DD.
    E.g:\n\n";
    print " %CheckProvActivity 2004 06 07\n\n\n";
    exit 1;
    }

    $WYear = $ARGV[0];
    $wMon = $ARGV[1];
    $WDay = $ARGV[2];

    $infileloc="/apps/log/opwv/provisioning";
    $filename = "$infileloc/Proxy_$WYear_$wMon_$WDay.log";
    $outputloc="/opt/opwv/smartins/";
    $outfile="$outputloc/ProvActivity_$WYear_$wMon_$WDay.txt";
    unlink $outfile;
    open(fileIN, $filename) or die ("Cannot open $filename: $!\n");


    Thanks,

    smartins68
     
    smartins68, Jun 9, 2004
    #1
    1. Advertising

  2. smartins68

    Joe Smith Guest

    smartins68 wrote:

    > I have a Perl code and I am receiving the error below and I am strugling
    >
    > $WYear = $ARGV[0];
    > $wMon = $ARGV[1];
    > $WDay = $ARGV[2];


    Those three statements wipe out the previous calculations done when
    no arguments are presented.

    ($WYear,$wMon,$WDay) = @ARGV unless defined $WYear;

    > $filename = "$infileloc/Proxy_$WYear_$wMon_$WDay.log";


    Uninitialized variables $WYear_ and $wMon_. ('_' is legal variable letter.)

    $filename = "$infileloc/Proxt_${WYear}_${wMon}_$WDay.log";


    -Joe

    P.S. Next time, post to comp.lang.perl.misc instead of comp.lang.perl .
     
    Joe Smith, Jun 9, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. G Kannan
    Replies:
    1
    Views:
    1,242
    Eric J. Roode
    Oct 11, 2003
  2. Sukhbir Dhillon
    Replies:
    1
    Views:
    6,258
    Joe Smith
    Apr 5, 2004
  3. S
    Replies:
    3
    Views:
    330
    Gunnar Hjalmarsson
    Feb 3, 2004
  4. Jesse Cary
    Replies:
    2
    Views:
    222
    J├╝rgen Exner
    Oct 15, 2004
  5. Amaninder
    Replies:
    6
    Views:
    226
    J. Gleixner
    Jul 18, 2006
Loading...

Share This Page