my $filename = @_;
to:
my $filename = $_[0];
Your code always assigns $filename=1, instead of the actual file name. Prove this to yourself by printing $filename inside your sub right after the assignment.
See also: Basic debugging checklist
In reply to Re: Subroutine processes only one file in the directory
by toolic
in thread Subroutine processes only one file in the directory
by sridhar56
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |