Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Use of uninitialized value in concatenation

Reply
Thread Tools

Use of uninitialized value in concatenation

 
 
smartins68
Guest
Posts: n/a
 
      06-09-2004
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


 
Reply With Quote
 
 
 
 
Joe Smith
Guest
Posts: n/a
 
      06-09-2004
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 .
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Use of uninitialized value in concatenation (.) or string Amaninder Perl Misc 6 07-18-2006 05:29 PM
(Newbie) Use of uninitialized value in concatenation (.) or string Jesse Cary Perl Misc 2 10-15-2004 09:47 PM
Re: Use of uninitialized value in concatenation (.) or string Error Sukhbir Dhillon Perl 1 04-05-2004 02:31 AM
Use of uninitialized value in concatenation (.) or string S Perl Misc 3 02-03-2004 09:54 PM
Use of uninitialized value in concatenation (.) at register.pl line 38, <STDIN> line 10. G Kannan Perl 1 10-11-2003 11:58 AM



Advertisments