Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: multi dimensional hash

by Marshall (Canon)
on Mar 06, 2018 at 02:21 UTC ( [id://1210382]=note: print w/replies, xml ) Need Help??


in reply to multi dimensional hash

If tag1 and tag3 are equal, this is overly complicated.
This line:
conferences NN conference
might be wrong?
#!/usr/bin/perl use strict; use warnings; use Data::Dumper qw(Dumper); my %hash; while (my $line = <DATA>) { next if $line =~ /^\s*$/; # skip blank lines my ($tag1, $tag2, $tag3) = split(/\s+/, $line); next unless $tag2 eq 'NN'; $hash{$tag3}++; } print Dumper \%hash; =prints $VAR1 = { 'well' => 1, 'conference' => 3, 'International' => 1, 'preparation' => 2 }; =cut __DATA__ The DT the International NN International for IN for well NN well preparation NN preparation preparation NN preparation in IN in conference NN conference conference NN conference conferences NN conference good VVG good

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (4)
As of 2024-03-28 18:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found