Thanks pvaldes and GrandFather, I have tried both of your methods. Both methods lead me to the same error:

syntax error at ./scriptfile line 55, near "if !~"

I should also have mentioned that the $TestFile also contains other options used in the script, which is initially the reason for why i used a foreach loop. here is the code if it helps any:

foreach $Line (<TESTFILE>) { next if ($Line =~ m/^#/); if ($Line =~ m/option1\s*=\s*(.*)/) { $option1 = $1; print "option1 = <$option1>\n"; } if ($Line =~ m/option2\s*=\s*(.*)/) { $option2 = $1; print "option2 = <$option2>\n"; } if ($Line =~ m/option3\s*=\s*(.*)/) { $option3 = $1; print "option3 = <$option3>\n"; } if ($Line =~ m/option4\s*=\s*(.*)/) { $option4 = $1; print "option4 = <$option4>\n"; } # if ($Line =~ m/To\s*=\s*(.*)/) { # $To = $1; # print "To = <$To>\n"; # } if ($Line =~ m/option6\s*=\s*(.*)/) { $option6 = $1; print "option6 = <$option6>\n"; } if ($Line =~ m/option7\s*=\s*(.*)/) { $option7 = $1; print "option7 = <$option7>\n"; } if ($Line =~ m/option8\s*=\s*(.*)/) { $option8 = $1; print "option8 = <$option8>\n"; } } close(TESTFILE);

In reply to Re: Sending Email to a list of people using Mail::Sender by mlebel
in thread Sending Email to a list of people using Mail::Sender by mlebel

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.