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

Re: Matching multiple {hits}

by Anonyrnous Monk (Hermit)
on Feb 13, 2011 at 19:20 UTC ( [id://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 };

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2024-04-20 04:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found