Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Perl Destroys Interview Question

by Anonymous Monk
on Jan 12, 2004 at 23:00 UTC ( [id://320806]=note: print w/replies, xml ) Need Help??


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. :-)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://320806]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-04-25 06:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found