#!/usr/bin/perl use strict; use warnings; my $entry; my @a; do { print"\n Press 1 to enter a File or 2 to count Total Combinations: "; $entry=; chomp ($entry); if ($entry==1) { print"\n\n Enter File Name to count number of LINES (.txt): "; my $filename = ; chomp $filename; open my $fh, "<", $filename or die "Cannot open $filename.\n"; $fh=~s/\s+$//g; # To remove white space & empty # lines after end of each text file my $count = 0; while ( <$fh> ) {$count++;} print"\n Lines in File $filename: $count\n\n"; push @a, $count; } } until ($entry==2); my $product=1; $product *= $_ foreach @a; print"\n\n Total Combinations: $product\n"; exit; #### C:\Users\x\Desktop>c.pl Press 1 to enter a File or 2 to count Total Combinations: 1 Enter File Name to count number of LINES (.txt): s1.txt Lines in File s1.txt: 864 Press 1 to enter a File or 2 to count Total Combinations: 1 Enter File Name to count number of LINES (.txt): s2.txt Lines in File s2.txt: 864 Press 1 to enter a File or 2 to count Total Combinations: 1 Enter File Name to count number of LINES (.txt): s3.txt Lines in File s3.txt: 864 Press 1 to enter a File or 2 to count Total Combinations: 2 Total Combinations: 644972544 C:\Users\x\Desktop>