M
mike.wilson8
New at Perl and I'm sure this is a stupid mistake. I'm reading a txt
file and unfortunately the lines wrap so I'm reading the lines as
$firstline and $secondline doing a substr as well. I'm getting the
"Use of initialized value" error on ##problem line below and was
wondering if anyone can assist?
Thanks,
Mike
$filename = "C:/Documents and Settings/C150391/Desktop/PL.xls";
$path = "C:/Documents and Settings/C150391/Desktop/ORBIT SEARCH
RESULTS.txt";
open (MSG, "$path") || die "Cannot open $path\n";
while($firstline = <MSG>)
{
$secondline = <MSG>;
if ($firstline =~/JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC/)
{
$tktnum = substr ($line,3,8);
$userid = substr ($line,14,5);
$pri = substr ($line,29,1);
$status = substr ($line,38,4);
$type = substr ($line,48,12);
$opened = substr ($line,62,7);
$lastupdated = substr ($line,74,6);
}
if ($secondline =~ /\s+\d+\s+\d+\s+\d+/) ##problem line
{
$oplstupdated = substr ($secondline,9,3);
$lstupdated = substr ($secondline,25,3);
$opentoday = substr ($secondline,41,3);
}
}
file and unfortunately the lines wrap so I'm reading the lines as
$firstline and $secondline doing a substr as well. I'm getting the
"Use of initialized value" error on ##problem line below and was
wondering if anyone can assist?
Thanks,
Mike
$filename = "C:/Documents and Settings/C150391/Desktop/PL.xls";
$path = "C:/Documents and Settings/C150391/Desktop/ORBIT SEARCH
RESULTS.txt";
open (MSG, "$path") || die "Cannot open $path\n";
while($firstline = <MSG>)
{
$secondline = <MSG>;
if ($firstline =~/JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC/)
{
$tktnum = substr ($line,3,8);
$userid = substr ($line,14,5);
$pri = substr ($line,29,1);
$status = substr ($line,38,4);
$type = substr ($line,48,12);
$opened = substr ($line,62,7);
$lastupdated = substr ($line,74,6);
}
if ($secondline =~ /\s+\d+\s+\d+\s+\d+/) ##problem line
{
$oplstupdated = substr ($secondline,9,3);
$lstupdated = substr ($secondline,25,3);
$opentoday = substr ($secondline,41,3);
}
}