Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Rosetta Code: Long List is Long

by Tux (Canon)
on Dec 01, 2022 at 09:18 UTC ( [id://11148472]=note: print w/replies, xml ) Need Help??


in reply to Rosetta Code: Long List is Long

Not a real contestant, but a different approach using TSV/XS (just because I could not resist):

$ cat -te tt1.txt camel^I42$ pearl^I94$ dromedary^I69$ $ cat -te tt2.txt camel^I8$ hello^I12345$ dromedary^I1$ $ perl -MText::CSV_XS=csv -wE'csv(in=>*ARGV,sep=>"\t",out=>undef,on_in +=>sub{$x{$_[1][0]}+=$_[1][1]});printf"%-20s %6d\n",$_,$x{$_}for sort +keys%x' tt?.t camel 50 dromedary 70 hello 12345 pearl 94

Enjoy, Have FUN! H.Merijn

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2024-03-28 20:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found