LMPX.COM |
Home | Linux | Mysql | PHP | XML | ||
|
|
|||
From: Mike Williams Date: Thu Apr 10 07:12:02 2008 Subject: Re: Sendmail
On Thu, Apr 10, 2008 at 12:41 AM, Perl CGI script enhancer < deepan.17@gmail.com> 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 "dpr.17\@gmail.com" > ie > > To : dpr.17\@gmail.com it works fine. > > populateEmail function's code is available below: > > populateEmail { > if(lc($_[0]) eq "test") { > return ("deepan.ignatius\@gmail.com"); > } > } > > 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 ("deepan.ignatius\@gmail.com"); } } # output from test ... $ ./cgi_list_bug.pl deepan.ignatius@gmail.com Mike
| Navigate in group perl.beginners.cgi at sever nntp.perl.org | |
| Previous | Next |
| © No Copyright You are free to use Anything |
Site Maintained by PHP Developer
Powered By PHP Consultants |