#!/usr/bin/perl -w print "Type in the name of the file you want to read: ", "\n" ; $count = 0 ; $filename = ; # reads in a file that I type in. chomp $filename ; # removes the newline after the filename open(FILE, $filename) || die "I can't read your file, it does not exist" ; while (defined ($line = )) { if ($line =~ /word/) ## { $name = substr($word, 2, 11) ; print "the word number is: ", $name, "\n" ; $count = 0 } elsif ($line !~ /#/) { $count++ ; } print "the number of text = ", $count, "\n" ; } close FILE ;