<?xml version="1.0" encoding="windows-1252"?>
<node id="990940" title="Use of uninitialized value $site in concatenation (.) when excute the perl script" created="2012-08-31 04:18:20" updated="2012-08-31 04:18:20">
<type id="115">
perlquestion</type>
<author id="977626">
laksh</author>
<data>
<field name="doctext">
when I am running the perl script where I user foreach to read the file line by line I got the print message.
"Use of uninitialized value $site in concatenation (.) or string at logfile.pl line 13, &lt;LOGFILE&gt; line 19."
&lt;code&gt;
#!/usr/bin/perl -w

use strict;
use warnings;
my ($time, $site, $logName, $fullName, $date, $gmt, $req, $file, $proto, $status, $length);
$site;
my $LOGFILE = "config.txt";
open LOGFILE,"$LOGFILE" or die "cannot open file : $!";
foreach my $line (&lt;LOGFILE&gt;) {
    
    ($site, $logName, $fullName, $date, $gmt,
         $req, $file, $proto, $status, $length) = split(' ',$line);
   my $a = "$site\n";
   print "--$a\n";
   my $b = "$logName\n";
   print "==$b\n";
 }
close(LOGFILE);
&lt;/code&gt;

Please let me know where I am doing the mistake.</field>
</data>
</node>
