Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I did try setting up @results and using push $File::Find::name into it but it has failed to collect all the data together in one, rather it outputs 1, hence my wondering about the arrays and lists. I'd be grateful for some enlightenment on how to do this most effectively.#!c:\perl\bin\perl.exe use strict; use warnings; use File::Find; use Net::SMTP; my $mailserver_url = "foo"; my $from = 'foo@bar.com'; my $to = 'foo@bar.com'; my $subject = "CONNREFUSED lists"; my @result =(); undef $/; find( sub { return if ($_ =~ /^\./); return unless ($_ =~ /\.autodel/i); stat $File::Find::name; return if -d; return unless -r; open(FILE, "< $File::Find::name") or return; my $string = <FILE>; close (FILE); return unless ($string =~ /\bCONNREFUSED\b/i); my $smtp = Net::SMTP->new(Host => 'foo'); #Sending the message $smtp->mail( $from ); $smtp->to( $to ); $smtp->data(); $smtp->datasend("To: $to\n"); $smtp->datasend("From: $from\n"); $smtp->datasend("Subject: $subject\n"); $smtp->datasend("\n"); # done with header $smtp->datasend("$results\n"); $smtp->dataend(); $smtp->quit(); # all done. message sent. }, 'X:\\baz\\MAIN');
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Collecting a list of filenames together
by wfsp (Abbot) on Dec 11, 2007 at 14:53 UTC | |
|
Re: Collecting a list of filenames together
by holli (Abbot) on Dec 11, 2007 at 14:52 UTC | |
|
Re: Collecting a list of filenames together
by osunderdog (Deacon) on Dec 11, 2007 at 16:40 UTC |