Re: The name of script itself
- From: gazelle@xxxxxxxxxxxxxxxxxxx (Kenny McCormack)
- Date: Thu, 05 Jan 2006 16:26:16 GMT
In article <QIGdnYTEG5hroCDeRVn-tw@xxxxxxxxxxx>,
Ed Morton <morton@xxxxxxxxxxxxxx> wrote:
....
>The order of the indices you get from "in" isn't guaranteed to be the
>numerically sorted so the above might produce "file" "gawk" "-f" or some
>other order. You need this instead if you want to do it in a loop:
That was my first thought, and, yes, in general, it is more idiomatic to
use a normal "C-style" for loop instead of the "foreach" style version.
But then I looked at it more carefully...
I think in this case, it would actually be OK to do it that way, provided
you were willing to assume that there's only one "-f". I.e., note that
even though he's accessing the array in random order, he is pulling the
"each+1" element once he finds a match.
.
- Follow-Ups:
- Re: The name of script itself
- From: MArek Simon
- Re: The name of script itself
- From: Ed Morton
- Re: The name of script itself
- References:
- The name of script itself
- From: MArek Simon
- Re: The name of script itself
- From: Kenny McCormack
- Re: The name of script itself
- From: MArek Simon
- Re: The name of script itself
- From: Ed Morton
- The name of script itself
- Prev by Date: Re: The name of script itself
- Next by Date: Re: The name of script itself
- Previous by thread: Re: The name of script itself
- Next by thread: Re: The name of script itself
- Index(es):
Relevant Pages
|