Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: [off-site] Bash + Perl oneliners basics

by grinder (Bishop)
on Mar 17, 2005 at 08:22 UTC ( #440296=note: print w/ replies, xml ) Need Help??


in reply to Re: [off-site] Bash + Perl oneliners basics
in thread [off-site] Bash + Perl oneliners basics

I know you're just tossing that code off quickly, but I'm curious to know why you chose to write:

while (<>) { my ($f) = (split)[6]; $count{$f}++; }

...rather than...

while (<>) { $count{(split)[6]}++; }

It makes me wonder if there's some robustness principle at work that eludes me. And of course, there is even...

$count{(split)[6]}++ while <>;

... but then we are getting into the realms of the cryptic, and I don't seen a more concise way of printing the top N values that doesn't sacrifice economy.

- another intruder with the mooring in the heart of the Perl


Comment on Re^2: [off-site] Bash + Perl oneliners basics
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (19)
As of 2015-07-30 13:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (271 votes), past polls