Dear Monks,
In the script below I am trying to parse through emails to find only certain elements. The code works, however, I am confounded by these warnings.
C:\grappa>grappa1-0.pl
Use of uninitialized value in print at C:\grappa\grappa1-0.pl line 49.
Use of uninitialized value in print at C:\grappa\grappa1-0.pl line 49.
Use of uninitialized value in print at C:\grappa\grappa1-0.pl line 49.
Use of uninitialized value in print at C:\grappa\grappa1-0.pl line 49.
Use of uninitialized value in print at C:\grappa\grappa1-0.pl line 49.
Use of uninitialized value in print at C:\grappa\grappa1-0.pl line 49.
Use of uninitialized value in print at C:\grappa\grappa1-0.pl line 49.
Use of uninitialized value in print at C:\grappa\grappa1-0.pl line 49.
Use of uninitialized value in print at C:\grappa\grappa1-0.pl line 49.
Use of uninitialized value in print at C:\grappa\grappa1-0.pl line 49.
There are ten warnings, and likewise, there are ten messages that I'm sorting through. Here is the output. If you know the problem, can you advise?
Rock 'n..
Saturday, December 01, 2001 06:03 PM
Linda Lutnam
http://dt.com/link/click?lid=310058
<46434979-220011153023294428@eiiance.com>
Times Ten.
#!/usr/bin/perl/ -w
### Grappa ###
use warnings;
use strict;
#use DBI();
my $flag = 0;
my $list = shift || 'c:\grappa\lists\list.txt';
my $output0 = shift || 'c:\grappa\output\output0.txt';
my $date = 'Date: ';
my $id = 'Message-Id: ';
my $ID = 'Message-ID: ';
my $subj = 'Spamvertised website: ';
my $from = 'From: ';
my @data = "";
open (LIST, "$list") || die "Can't Open $list";
my @list=<LIST>;
close(LIST);
foreach (@list){
if(s/.*$date//){
$data[0] = $_;
$flag =0;
}
if(s/.*$from//){
$data[1] = $_;
$flag =0;
}
if(s/.*$subj//){
$data[2] = $_;
$flag =0;
}
if(s/.*$id//){
$data[3] = $_;
$flag =0;
}
if(s/.*$ID//){
$data[4] = $_;
$flag =0;
open STDOUT,">>$output0";
print STDOUT @data; # This is line 49
close STDOUT;
}
}