in reply to What would you do?

# set even elements of @list to 'hi'... $_ % 2 or $list[$_] = 'hi' for 0..$#list;
And yes, the comment would be mandatory.

-- Randal L. Schwartz, Perl hacker

Replies are listed 'Best First'.
Re: Re: What would you do?
by jlawrenc (Scribe) on Mar 16, 2001 at 23:02 UTC
    I would like to underscore the wisdom of merlyn's comment comment.

    Not only does his comment exist, but it is a succinct explaination of the code. (It is not an English translation of the statement like: do nothing if default variable is not mod 2 otherwise set the list of the default variable to 'hi' for the size of the list.).

    Good example - good style. I wish more people would follow this example! :)

Re: Re: What would you do?
by Anonymous Monk on Mar 16, 2001 at 04:27 UTC
    How is the comment mandatory? It works fine without it.