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

Reply via email to