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); } }
In reply to $var$cnt problems by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |