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

Re: Matching multiple {hits}

by Anonyrnous Monk (Hermit)
on Feb 13, 2011 at 19:20 UTC ( #887889=note: print w/ replies, xml ) Need Help??


in reply to Matching multiple {hits}

#!/usr/bin/perl -w use strict; my %customers; while (my $line = <DATA>) { while ($line =~ m/{(.*?)}/g) { my $customer_name = $1; $customers{ $customer_name }++; } } use Data::Dumper; print Dumper \%customers; __DATA__ AB1\tA{Daniel Wright}\sA{Jack Smith}\sB{Jane Goodwin} QW1\tA{Samantha Patton}\sC{Timothy Eeckles} AR2\tA{Jane Goodwin}
$VAR1 = { 'Jane Goodwin' => 2, 'Daniel Wright' => 1, 'Timothy Eeckles' => 1, 'Jack Smith' => 1, 'Samantha Patton' => 1 };


Comment on Re: Matching multiple {hits}
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2015-07-04 19:21 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 (60 votes), past polls