flieckster has asked for the wisdom of the Perl Monks concerning the following question:
ideally i'd list the files in one email like such. any help in modifying my code to be more scaliabe would be helpful.1 TUMI files 0 BW files 0 maurices files
code below::1 TUMI file TUMI-1354839054_alt1 1.psd 2 maurices files maur-1111.psd maur-1110.psd
#!/usr/bin/perl -w use Net::FTP; use File::Copy; use File::Basename; use Email::Send::SMTP::Gmail; use POSIX qw(strftime); my $date = strftime("%m-%d-%y",localtime); my $time = strftime("%I:%M:%S",localtime); my $photo_error_folder = "/Volumes/photorepos/Partners/WorkHorse/ERROR +/PhotographyDrop_ERROR"; my $post_error_folder = "/Volumes/photorepos/Partners/WorkHorse/ERROR/ +PostDrop_ERROR"; my $subject = "ICS -- Files in the Error Folder "; my $dllist ='bflieck@xxx.com'; chdir( $photo_error_folder ) or print "Cant chdir to $photo_error_fold +er $!"; my $count = (@photo_err_list) = glob '"*{jpg,tif,tiff,psd}"'; if ($count > 0) { my ($mail,$error)=Email::Send::SMTP::Gmail->new( -smtp=>'smtp.gmail.co +m', -login=>'kopautomatio +n1@xxx.com', -pass=>'xxx', -layer=> 'ssl', -port=> '465', -debug=> 1, -timeout=> 1000); $tumi_count = grep { /TUMI/ } @photo_err_list; if ($tumi_count > 0) { print "$tumi_count TUMI files\n"; } else { print "$tumi_count TUMI files\n"; } $bw_count = grep { /BW/ } @photo_err_list; if ($bw_count > 0) { print "$bw_count BW files\n"; } else { print "$bw_count BW files\n"; } $maurices_count = grep { /Maur/ } @photo_err_list; if ($maurices_count > 0) { print "$maurices_count Maurices files\n"; } else { print "$maurices_count maurices files\n"; } my $body="please fix and redrop or delete the<br> file://$photo_error_folder/<br><br> "; my $spacer ="<br>"; my $body1= join "<br>\n", @photo_err_list; $mail->send(-to=>"$dllist", -from=>"$dllist", -subject=>"$subject", -b +ody=>"$body $spacer $body1", -contenttype=>"text/html"); $mail->bye; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: count multiple variables in a single array.
by 1nickt (Canon) on Feb 26, 2020 at 20:41 UTC | |
|
Re: count multiple variables in a single array.
by Marshall (Canon) on Feb 27, 2020 at 06:30 UTC | |
by flieckster (Scribe) on Feb 28, 2020 at 18:41 UTC | |
by holli (Abbot) on Feb 29, 2020 at 14:13 UTC | |
by Your Mother (Archbishop) on Feb 28, 2020 at 19:43 UTC | |
by Marshall (Canon) on Feb 28, 2020 at 23:11 UTC | |
by Marshall (Canon) on Feb 28, 2020 at 19:37 UTC | |
|
Re: count multiple variables in a single array.
by AnomalousMonk (Archbishop) on Feb 26, 2020 at 21:36 UTC |