Tom Tromey <[EMAIL PROTECTED]> writes:

> +    # Make a hash holding all the values from $WHEN.
> +    my (%cond_vals);
> +    grep ($cond_vals{$_} = 1, split (' ', $when));

It's generally considered poor Perl coding style to use grep for its side
effects alone without checking the return value.  It can make people blink
a few times as they try to figure out why grep is being used.  :)  I'd
write that instead as:

    my %cond_vals = map { $_ => 1 } split (' ', $when);

which is the Lisp-ish way to do it.  A more C-like and equally valid way
of writing it is:

    my %cond_vals;
    for (split (' ', $when)) {
        $cond_vals{$_} = 1;
    }

(s/for/foreach/ if you prefer it).

-- 
Russ Allbery ([EMAIL PROTECTED])             <http://www.eyrie.org/~eagle/>

Reply via email to