#!/usr/bin/perl -w use strict; my $file = "/home/trix/lines"; my $line; my @array; open (FILE, "$file") || die "Can't open $file: $!\n"; while ($line = ) { chomp $line; next unless ($line =~ /Down/); my ($downtime, $down) = split(' ', $line); push (@array, $downtime); } my $agg = eval join '+', @array; #the above beauty came from somewhere here; don't remember where print "My downtime is $agg\n";