in reply to Perl Destroys Interview Question

While you were at it you should have used strict, or else a one liner would have served the purpose just the same.

perl -lane '$w{lc $_}++ for @F;END{print for sort keys %w}' text.txt

Replies are listed 'Best First'.
Re: Re: Perl Destroys Interview Question
by redsquirrel (Hermit) on Jan 13, 2004 at 15:09 UTC
    I am usually a strict zealot, but in this case, I felt it would take a little away from the conciseness of the solution. So I consciously left it out.

    A one-liner certainly would have served the purpose, but it wouldn't have been as readable. This was an interview question, not a Perl Golf competition. :-)