Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

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

by grinder (Bishop)
on Mar 17, 2005 at 08:22 UTC ( [id://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

Log In?
Username:
Password:

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

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

    No recent polls found