Re: OT: How to do a reverse word list in Perl
From: | Philip Newton <philip.newton@...> |
Date: | Friday, October 27, 2006, 19:13 |
On 10/27/06, Kris Kowal <cowbertvonmoo@...> wrote:
> So, adding schwartzian transform, using the default input <>, and
> making a few idiomatic perl suggestions of my own:
>
> #!/usr/bin/perl -w
> print for
> map {$_->[1]}
> sort {$a->[0] cmp $b->[0]}
> map {
> [
> (reverse $_),
> sprintf "%20s", $_
> ]
> }
> <>;
I'd suggest scrapping the "for" and just printing the list returned by
map in one go.
Chees,
--
Philip Newton <philip.newton@...>