Re: map woes
- From: Mirco Wahab <wahab-mail@xxxxxx>
- Date: Thu, 28 Jun 2007 22:24:38 +0200
seven.reeds wrote:
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?
There have been correct answers already, but I'll
add another version to the dozen (what I think what would
be somehow appropriate) ...
...
sub descending { $b<=>$a }
...
opendir my $dirh, '.' or die "cant't opendir!$!";
my @list = sort descending map /\d+(?=\.news)/g, readdir $dirh;
closedir $dirh;
...
Regards
M.
.
- References:
- map woes
- From: seven.reeds
- map woes
- Prev by Date: Re: new in CGI::Session::Driver::postgredsql nonexisting
- Next by Date: 2 dimentional data call within a conditional
- Previous by thread: Re: map woes
- Next by thread: new in CGI::Session::Driver::postgredsql nonexisting
- Index(es):
Relevant Pages
|
|