Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Arithmatic operation in PERL

by CharlesClarkson (Curate)
on Nov 20, 2001 at 04:31 UTC ( #126432=note: print w/ replies, xml ) Need Help??


in reply to Arithmatic operation in PERL

TIMTOWTDI

my %movies; { local $/ = "\n\n"; while ( <DATA> ) { next unless s/\*\s+Movie="([^"]+)"\s+show=(\d+)//; $movies{$1}{$2} += $_ for 0, grep $_ > 20, split ' '; } print Dumper \%movies; } __END__ * Movie="ABC" show=4 10 20 30 14 90 30 21 13 11 10 09 23 22 05 22 15 19 20 * Movie="XYZ" show=4 10 20 30 14 90 30 21 13 11 10 09 23 22 05 22 15 19 10 * Movie="abc" show=4 10 10 10 14 10 10 11 13 11 10 09 13 12 05 12 15 19 10



HTH,
Charles K. Clarkson


Language is the dress of thought.
- Samuel Johnson


Comment on Re: Arithmatic operation in PERL
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (9)
As of 2015-07-06 06:04 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 (70 votes), past polls