in reply to how to get total numbers of files in a directory?

hweefarn,
As you can see, there are many ways to do it. Some of them do not involve Perl at all. I feel that it is worth while to point out that you can use shortcuts when you know your data. If you are not 100% sure of your data, then you need to take a little longer. Consider for instance that you have a directory called /home/a/blah.txt and you only want to count text files, not directories.
#!/usr/bin/perl -w use strict; my $total; for ( glob ('/home/a/*.txt') ) { $total++ if ! -d; } print "The total is $total\n";
Of course, this will only skip directories. If you want to avoid other kinds of files, you should take a look at perldoc -f -X. Welcome to The Monastery.

Cheers - L~R