my $minfilename = shift; # = $ARGV[0]; : : #somewhere in the loop: if($f eq $minfilename){ #store values to substract them later }