Does @files change during the loop? otherwise, you'll end up with $count having always the same value.
if you are inside a loop, the my variables are only for that one iteration. Is this what you want?
$count is not a very good variable name
I think you want:
before the foreach loop: my $file_number = 0;
in the loop: $file_number += 1;
Plus you seem to get the sigils wrong - see the first part of → perldata: @whatever is an array, a single element of that array is $whatever[123]. @whatever[123] is an array slice.