Kirche has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to count number of files for each extension in a folder:
I'm getting following error: Use of uninitialized value in hash element at line 4. But if i replace += with = it shows no error. What i'm doing wrong?opendir H, './'; $ext{$1} += (m/([^.]+)$/) for grep { -f } readdir H; closedir H; print "$_ - $ext{$_}\n" for keys %ext;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: File ext number
by toolic (Bishop) on Mar 19, 2010 at 23:24 UTC | |
Re: File ext number
by ikegami (Patriarch) on Mar 19, 2010 at 23:20 UTC | |
by toolic (Bishop) on Mar 19, 2010 at 23:38 UTC | |
by ikegami (Patriarch) on Mar 19, 2010 at 23:54 UTC | |
Re: File ext number
by BrowserUk (Patriarch) on Mar 19, 2010 at 23:43 UTC | |
Re: File ext number
by Lady_Aleena (Priest) on Mar 20, 2010 at 01:13 UTC | |
by ikegami (Patriarch) on Mar 20, 2010 at 03:13 UTC | |
by Lady_Aleena (Priest) on Mar 20, 2010 at 03:54 UTC | |
by jwkrahn (Abbot) on Mar 20, 2010 at 03:49 UTC | |
by Lady_Aleena (Priest) on Mar 20, 2010 at 04:34 UTC | |
by jwkrahn (Abbot) on Mar 20, 2010 at 09:26 UTC | |
by Marshall (Canon) on Aug 22, 2010 at 00:18 UTC | |
Re: File ext number
by snopal (Pilgrim) on Mar 19, 2010 at 23:06 UTC | |
by ikegami (Patriarch) on Mar 19, 2010 at 23:16 UTC |
Back to
Seekers of Perl Wisdom