S
seven.reeds
Hi,
I have out-smarted myself. I have a directory that has various files
inside. Some are named like:
<number>.zone
The "<number>" bit is a simple integer so you might have the files:
1.zone, 31.zone, 820.zone, etc
I can open the dir. I can readdir() to get the filenames, grep() to
get the "\d+\.zone" files but now I want to pull off the numbers, sort
them numericaly highest to lowest and store them for later use. I
have tried
my @list =
sort {$b <=> $a}
map {s/(\d+)\.news/$1/}
grep(/\d+\.news/, readdir(NEWSDIR));
The readdir and grep work as I expect. The result of the map is a
list of "1"s, prolly the count of successful s// matches. Where am I
messing this up?
I have out-smarted myself. I have a directory that has various files
inside. Some are named like:
<number>.zone
The "<number>" bit is a simple integer so you might have the files:
1.zone, 31.zone, 820.zone, etc
I can open the dir. I can readdir() to get the filenames, grep() to
get the "\d+\.zone" files but now I want to pull off the numbers, sort
them numericaly highest to lowest and store them for later use. I
have tried
my @list =
sort {$b <=> $a}
map {s/(\d+)\.news/$1/}
grep(/\d+\.news/, readdir(NEWSDIR));
The readdir and grep work as I expect. The result of the map is a
list of "1"s, prolly the count of successful s// matches. Where am I
messing this up?