in reply to Perl 101 Problem

my first suggestion is:
always check the return code of open():
open FILE,$filename or die "Could not open '$filename': $!";

and, of course, always

use warnings; use strict;
update: that should be -w in the shebang instead of use warnings for your version of perl...
update2: minor typo