Re: Splitting and comparing file names
- From: boyd <tbmoore9@xxxxxxxxxxx>
- Date: Thu, 14 Dec 2006 17:06:22 GMT
In article <1166114810.087246.179750@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
"Jake" <Jake.Newly@xxxxxxxxx> wrote:
Thanks to some help on another thread I have a perl script that will....
generate a file in the following format:
hostname#val1#val2#val3.load
@filesfound = sort (grep (/\.load$/, readdir(DIR)));# insert something like this:
if ( ! @filesfound) {
die ("None of the load files were found. Please verify that
the writeLoad.pl script is running properly. $!\n");
closedir(DIR);
}
else {
foreach $filename(@filesfound) {
use List::Util qw(sum); # normally put near the top.
$filename =~ s/.load$//;
my($host, @times) = split '#', $filename;
my $avg = sum(@times) / (scalar @times); # @times would work,
# but scalar guarantees the number of elements.
};
Any ideas would be great. Keep in mind that I'm not a developer and
I'm sitting down with perl books and the internet to try to figure this
out. :)
At the moment I'm trying to read through and find information for
manipulating array data and I must admit that I'm just not getting it
yet.
Jake
Boyd
.
- Follow-Ups:
- Re: Splitting and comparing file names
- From: Jake
- Re: Splitting and comparing file names
- From: Paul Lalli
- Re: Splitting and comparing file names
- References:
- Splitting and comparing file names
- From: Jake
- Splitting and comparing file names
- Prev by Date: Splitting and comparing file names
- Next by Date: Re: Splitting and comparing file names
- Previous by thread: Splitting and comparing file names
- Next by thread: Re: Splitting and comparing file names
- Index(es):