#!/usr/local/bin/perl -w use strict; # never, never leave home without it. my ($currentLine, $name); #not needed because not used!! my $infilename = "temp1.pl"; open (INFILE, "$infilename") || die "Thanks for pointing this out chromatic: $!"; while () { if (/^Total/) { my @values = split; #do something with $value[3] and $value[4]; } }