Use of uninitialized value in concatenation

S

smartins68

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
 
J

Joe Smith

smartins68 said:
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 .
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top