Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: statistics of a large text

by perl_lover_always (Acolyte)
on Jan 31, 2011 at 14:51 UTC ( #885285=note: print w/replies, xml ) Need Help??


in reply to Re: statistics of a large text
in thread statistics of a large text

How can I use search::dict while my line is like this:
"$key\t@numbers" ?
example:
the\t1 5 8 34 56 the one\t1 5 56 the one of\t1 56
I want to search for "the one of" and retrieve "1 56" or an array including 1 and 56. Thanks alot in advance.

Replies are listed 'Best First'.
Re^3: statistics of a large text
by tilly (Archbishop) on Feb 01, 2011 at 07:21 UTC
    Assuming that you've done a use Search::Dict; and $fh is an open filehandle to your file then (untested code written by drunk person alert):
    sub match { my $string = quotemeta(shift); Search::Dict::look($fh, $string); my $next_line = <$fh>; if ($next_line =~ /$string: (\d+\s*)+/) { return split /\s+/, $1; } }

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2021-03-05 23:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favorite kind of desktop background is:











    Results (115 votes). Check out past polls.

    Notices?