You might want to use "use warnings" instead of "-w", so that you can remove warning using "no warnings" pargma, where you wouldn't want some.
Always check the return for the open function like so: open $fh,'<',$filename or die "can't open file: $!" OR you use use autodie qw(open close);
The File handler $fh decleared was not used
filehandle $fh was not close. You should do that like so:close $fh or die "can't close file:$!"
You really might what to try out the module "perlcritic", based on Damian Conway's book Perl Best Practices. Check Perlcritic
Using it from Command Line Interface like so: perlcritic -3 perlscript.pl