Total Count = 0 #I want the total count of 5 here. . .. file1 file2 file3 Total count = 5 #I want this total count up on the top of output instead of here. #### use strict; my $newfile = "./"; opendir(DIR,$newfile); my @files = readdir(DIR); close(DIR); my $ct = 0; chdir ($newfile) || die "Could not change to $newfile directory\n$!\n"; print "Total count = $ct\n\n"; for(@files) { print "$_\n"; $ct++ } print "\nTotal count = $ct\n";