Sendmail
my $email = populateEmail(test); print $email; open(SENDMAIL, |/usr/lib/sendmail -oi -t -i) or print cannot open SENDMAIL: $!; print SENDMAIL EOF; From: [EMAIL PROTECTED] To:${email} Subject: [SUSTAINING TICKET] Case Content-type: text/html testing.. EOF close(SENDMAIL); When i a using the above code it results in No recipient address found in header and when i replace ${email} with [EMAIL PROTECTED] ie To : [EMAIL PROTECTED] it works fine. populateEmail function's code is available below: populateEmail { if(lc($_[0]) eq test) { return ([EMAIL PROTECTED]); } } Can anyone spot the bug? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Sendmail
On Thu, Apr 10, 2008 at 12:41 AM, Perl CGI script enhancer [EMAIL PROTECTED] wrote: my $email = populateEmail(test); print $email; When i a using the above code it results in No recipient address found in header and when i replace ${email} with [EMAIL PROTECTED] ie To : [EMAIL PROTECTED] it works fine. populateEmail function's code is available below: populateEmail { if(lc($_[0]) eq test) { return ([EMAIL PROTECTED]); } } Can anyone spot the bug? Well, I didn't see it at first, so I cut and pasted a snippet of your code into a local file, ran it at the command line and got: Undefined subroutine main::populateEmail called at ./cgi_list_bug.pl line 6 What you posted was missing 'sub' before populateEmail #!/usr/bin/perl # use strict; use warnings; my $email = populateEmail(test); print $email, \n; sub populateEmail { if(lc($_[0]) eq test) { return ([EMAIL PROTECTED]); } } # output from test ... $ ./cgi_list_bug.pl [EMAIL PROTECTED] Mike
Re: Testing an array for a match
Lou Hernsen wrote: Hallo Hello, I have an array @Treasures and I want to match anywhere in it for /:1:2:3:/ can I if (@Treasures =~ /:1:2:3:/){} or do i have to change (@Treasures to $Treasures and then $Treasures = @Treasures ; if ($Treasures =~ /:1:2:3:/){} if ( grep /:1:2:3:/, @Treasures ) { John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools at low cost and in short order.-- Larry Wall -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Sendmail
Mike Williams wrote: On Thu, Apr 10, 2008 at 12:41 AM, Perl CGI script enhancer [EMAIL PROTECTED] wrote: my $email = populateEmail(test); print $email; snip Well, I didn't see it at first, so I cut and pasted a snippet of your code into a local file, ran it at the command line and got: Undefined subroutine main::populateEmail called at ./cgi_list_bug.pl line 6 snip This same question (without the missing 'sub') has already been asked and answered in clpmisc. http://groups.google.com/group/comp.lang.perl.misc/browse_frm/thread/c8c266eb779a4cb4 -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/