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; } }

In reply to Uninitialized Value by amearse

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.