Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
For some reason, it's not liking me appending $cnt to the variables because it errors out with
Since $fmail doesn't exist and neither does $fname, the script fails. Does anyone know how I can fix this problem?Global symbol "$fmail" requires explicit package name at raf.pl line 9 +2. syntax error at raf.pl line 92, near "$fmail$cnt " Global symbol "$fmail" requires explicit package name at raf.pl line 9 +5. Global symbol "$fname" requires explicit package name at raf.pl line 9 +8.
my $cnt = 0; for (1 .. 5) { $cnt++; if ($fmail$cnt ne "") { open(MAIL,"| $sendmail") or die "Can't open sendmail $!"; print MAIL "To: $fmail$cnt\n"; print MAIL "From: $email\n"; print MAIL "Subject: Refer A Friend\n"; print MAIL "Dear $fname$cnt,\n\n"; print MAIL "Your friend, $name at $email, visited out site re +cently and thought you would be interested..\n\n"; print MAIL "This is NOT spam. This email was sent by someone +who said they knew you. Your email address is not stored in any data +bases and will not be sold or given to anyone at any time. This is the only time you wil +l receive an email from us."; close(MAIL); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: $var$cnt problems
by castaway (Parson) on Jul 08, 2005 at 16:38 UTC | |
|
Re: $var$cnt problems
by monarch (Priest) on Jul 08, 2005 at 16:36 UTC | |
by sgifford (Prior) on Jul 08, 2005 at 18:44 UTC | |
by merlyn (Sage) on Jul 09, 2005 at 08:11 UTC | |
by monarch (Priest) on Jul 09, 2005 at 13:30 UTC | |
by merlyn (Sage) on Jul 09, 2005 at 17:38 UTC | |
by Anonymous Monk on Jul 09, 2005 at 19:17 UTC | |
|
Re: $var$cnt problems
by davidrw (Prior) on Jul 08, 2005 at 16:37 UTC | |
|
Re: $var$cnt problems
by holli (Abbot) on Jul 08, 2005 at 16:33 UTC | |
|
Re: $var$cnt problems
by Transient (Hermit) on Jul 08, 2005 at 16:32 UTC | |
|
Re: $var$cnt problems
by tphyahoo (Vicar) on Jul 08, 2005 at 16:32 UTC | |
by holli (Abbot) on Jul 08, 2005 at 16:37 UTC |