Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: threads::shared vs IPC::Shareable

by james28909 (Deacon)
on Dec 02, 2015 at 19:40 UTC ( [id://1149209]=note: print w/replies, xml ) Need Help??


in reply to threads::shared vs IPC::Shareable

Is there a specific reason you cant handle it all in one script/thread/process instead?
use strict; use warnings; my %hash; while(<DATA>){ my ($key, $value) = split(/\s+/, $_); $hash{$key} = $value; } foreach(keys %hash){ if ($_ =~ /this|is|a|test/){ print "found string \"$_\" and its value is \"$hash{$_}\"\n"; } } __DATA__ this 1 is 2 a 3 test 4

This would read a logfile and add all of its contents to the hash. Then you can do functions foreach key or value. Honestly, I wouldnt even use a hash or an array, I would just loop through the logfile and do functions foreach line. I cannot comment about threads as I never had any situation that I absolutely needed them myself.

Also, posting some form of code snippet or input data would help as well

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2024-03-29 00:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found