Re: Solution [was Re: New Quiz: "What does this code do?" (3-Jan-2006)]
Paul Johnson <[email protected]> Sun, 8 Jan 2006 13:12:21 +0100
| Newsgroups | gmane.comp.lang.perl.qotw.discuss |
|---|---|
| Message-ID | <[email protected]> |
On Sun, Jan 08, 2006 at 12:31:59AM -0500, Ron Isaacson wrote:
> for DIRVAR in ${DIRVARS[*]}; do
> One enhancement would be to automatically sort the DIRVARS list so the
> longest paths are at the front, in case one is a prefix of another.
> Sadly though, bash doesn't expose a sort builtin. If there were a
> bash-qotw list, I might propose implementing various sort algorithms
> using only shell builtins. :-)
Though the zsh-qotw list might be a little bored (well, for the simple
case anyway):
for DIRVAR in ${(O)DIRVARS}; do
I suspect the zsh lists might have a bit of fun implementing different
algorithms though. If you ever get fed up with people telling you that
Perl looks like line noise, have a look at some of the wonderful
solutions delivered on the zsh lists.
--
Paul Johnson - [email protected]
http://www.pjcj.net