Hi, At some directory, I wish to check are there some new file generated with
step* if no new generated, I wish it sleep for a while if there are some new files generated, I wish it to send am email to myself. Here is what I have came up so far, #!/usr/bin/env perl use strict; use warnings; use 5.012; use File::Glob ':glob'; use Time::HiRes qw(sleep); use Mail::Sendmail; my $old_num = 1; my $new_num; while($old_num < 100){ checkfile(); if ($new_num == $old_num){ sleep(0.1); } if ($new_num != $old_num){ $old_num = $new_num; sendmail(); } } sub checkfile{ my @filelist = bsd_glob("step*"); my $new_num = scalar(@filelist); } sendmail( From => '', To => 'l...@xxx.com', Subject => 'Step coming close', Message => "Dangerous", ); My problem is that: 1] I don't know how to make it better. this one looks clumsy? 2] sorry to say, I still try to install Mail::Sendmail; Are there some solutions use mail in bash directly. Thanks with best regards, -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/