in reply to Re^2: Passing the contents of a file in a "system" call to a .ksh script
in thread Passing the contents of a file in a "system" call to a .ksh script

Elwood-- Here's one way:
my @emails; my $ADMINLIST = '/path/to/admin.lst'; open(IN,"$ADMINLIST") or die("Can't open $ADMINLIST: $!"); while (<IN>){ if (my $addr = (split(/:/,$_))[4]) { push(@emails,$addr); } } close IN;

That grabs the 5th element (numbered from zero) of each line; then you can print the list to the SENDMAIL pipe as I did earlier.

  • Comment on Re^3: Passing the contents of a file in a "system" call to a .ksh script
  • Download Code