Beefy Boxes and Bandwidth Generously Provided by pair Networks chromatic writing perl on a camel
There's more than one way to do things
 
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 imbibing at the Monastery: (11)
As of 2014-04-23 19:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (553 votes), past polls