The_Last_Monk has asked for the wisdom of the Perl Monks concerning the following question:
It always prints the "Has no items" and then proceeds to print fhe file name like French.txt and Spanish.txt. Am i doing something wrong? I also tried looping through the data array and printing stuff but it ended up not printing anythingopendir(DIR,$dir) or die "dead"; @textfiles = readdir DIR; foreach(@textfiles){ @data = stat($_); if(scalar(@data) == 0) { print "Has no items"; } print "$_\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Stat function returning an empty list
by Paladin (Vicar) on Mar 06, 2015 at 21:08 UTC | |
by The_Last_Monk (Novice) on Mar 06, 2015 at 21:16 UTC | |
|
Re: Stat function returning an empty list
by Discipulus (Canon) on Mar 06, 2015 at 21:21 UTC | |
|
Re: Stat function returning an empty list (path/tiny)
by Anonymous Monk on Mar 06, 2015 at 22:04 UTC | |
by Anonymous Monk on Mar 06, 2015 at 23:08 UTC | |
by Anonymous Monk on Mar 07, 2015 at 01:39 UTC | |
by Anonymous Monk on Mar 07, 2015 at 06:53 UTC | |
by Anonymous Monk on Mar 07, 2015 at 08:26 UTC | |
|
Re: Stat function returning an empty list
by Anonymous Monk on Mar 06, 2015 at 21:41 UTC |