Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
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 };

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://887889]
help
Chatterbox?
[LanX]: so the mayor of London should be better named First Minister of the London region and is on a comparable level like Nicola Sturgeon
[LanX]: ?

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (10)
As of 2017-12-15 18:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (440 votes). Check out past polls.

    Notices?