Help modify my perl script?

Help modify my perl script?

Post by Ron Ablan » Sat, 14 Jun 1997 04:00:00



Could someone please help me modify this perl script file?  What it does  
is it takes an ascii file and sends it as a message to each member in
another text file.  I need this file to just pause one second after it
says

every email address.  Thanks.

#!/sequoia/software/perl/bin/perl
# SHPE distribution
open(SOURCE,"distribution_list") || die "cannot open distribution_list";
print "Enter file to distribute:  ";
$distribution_file = <STDIN>;
chop($distribution_file);
print "Enter message subject string:  ";
$subject = <STDIN>;
chop($subject);
while ($field = <SOURCE>) {
    chop($field);
    unless (fork) {
        exec("mailx -s '$subject' $field < $distribution_file");
    }
    print "Message sent to: $field, press (Enter) to continue" ;
    $espera = <STDIN> ;

Quote:}

close(SOURCE);
 
 
 

Help modify my perl script?

Post by Paul D. Smi » Sat, 14 Jun 1997 04:00:00



  ra> Could someone please help me modify this perl script file?

This doesn't belong on this group; try one of the perl lists.

  ra> is it takes an ascii file and sends it as a message to each member
  ra> in another text file.  I need this file to just pause one second

  ra> having to hit enter after every email address.  Thanks.

Change this:

  ra>     print "Message sent to: $field, press (Enter) to continue" ;
  ra>     $espera = <STDIN> ;

To this:

  print "Message sent to: $field\n";
  sleep 1;

See the perl documentation for a description of the sleep function.

--
-------------------------------------------------------------------------------

 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist
-------------------------------------------------------------------------------
     These are my opinions--Bay Networks takes no responsibility for them.

 
 
 

1. please help me modify this perl script

Could someone please help me modify this perl script that I just
inherited?
I got this because I am the new secretary for this club at my
university.
What it does is send an ascii text file as a message to all members of a
distribution list which contains email addresses (one per line).  I
would
like it to do 2 things: 1) allow one to backspace when it prompts me for
data and 2) eliminate those fork errors that I somehow don't get when I
split the distribution list in half and run the script for each.  Just
for your info, we have about 66 members on the list.

#!/sequoia/software/perl/bin/perl
open(SOURCE,"distribution_list") || die "cannot open distribution_list";
$SentCounter = 0;
print "Enter file to distribute:  ";
$distribution_file = <STDIN>;
chop($distribution_file);
print "Enter message subject string:  ";
$subject = <STDIN>;
chop($subject);

print "\n     This could take a while.  Please wait.\n\n";
while ($field = <SOURCE>) {
    chop($field);
    unless (fork) {
        exec("mailx -s '$subject' $field < $distribution_file");
    }
    print "Message sent to: $field\n";
    sleep 5;
    $SentCounter = $SentCounter + 1;
print "\n     All done!\n\n" ;
print "     Mail sent to: $SentCounter users\n\n";
close(SOURCE);

2. ethernet - 3com3c509

3. Execute a sh script under perl and sh: sh script; perl script?

4. Netscape will not run

5. Modify my perl script?

6. FTP Denied Access

7. modifying the printcap with shell- or perl-scripts

8. ufsdump under SUNOS

9. A script that modifies other scripts

10. Apache-perl: place html files and perl scripts in the same location

11. ksh 1, perl 2 - ksh or perl for scripting?

12. Help needed for modify backup log scripts

13. Incomplete output from crontab email: running shell scripts from a perl script