in reply to Re: Re: how to get total numbers of files in a directory?
in thread how to get total numbers of files in a directory?
my $cnt = glob "/home/a/*.txt";
Unfortunately, no. It would be more intuitive that way, but the real behavior of that is to set $cnt to the first filename in the list of exansions.
The clunky fix is to force list context...$ touch {a,b,c}.txt; perl -le 'my $c = glob "*.txt"; print $c' a.txt
$ touch {a,b,c}.txt; perl -le 'my $c =()= glob "*.txt"; print $c' 3
-sauoq "My two cents aren't worth a dime.";
|
|---|