in reply to Re^2: Working with a unkown number of arrays
in thread Working with a unkown number of arrays
Yes, that's much closer! Let me correct a couple of small nits:
if ($_ =~ /\d*/){ ##if directory name is a numberThe $_ is unnecessary there. Be very careful with that regex, though; it matches strings with zero or more digits. I think you might do better with if (/\.\d+/) {.
foreach (@directories) { my $dir_num = $_;
I see this pattern often and don't understand it. It's much simpler to write:
for my $dir_num (@directories) {Of course, you can still use foreach there in place of for if you want, but they're synonyms, so I use the shorter one.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Working with a unkown number of arrays
by jdporter (Paladin) on Feb 05, 2007 at 20:13 UTC |