$input_file = "sample.txt";
$output_file = "sample-output.txt";

open (INFILE, $input_file) or die "The file $input_file couldn't be found\n";
open (OUTFILE, ">$output_file") or die "The file $output_file couldn't be written\n";

# Loop, continuing as long as a line can be read successfully from the file
while ($line = <INFILE>)        
{
    $count = 0;        
    $lines++;
    @non_vowels = split(/[aeiou]/, $line);
    $count = $#non_vowels;
    print "Line $lines: $count vowels\n";
}

close INFILE;
close OUTFILE;
