you have a question on how to do something in Perl, or
you need a Perl solution to an actual real-life problem, or
you're unsure why something you've tried just isn't working...
then this section is the place to ask. Post a new question!
However, you might consider asking in the chatterbox first (if you're a
registered user). The response time tends to be quicker, and if it turns
out that the problem/solutions are too much for the cb to handle, the
kind monks will be sure to direct you here.
This isn't so much a perl question as an algorithm question but the solution will be coded in perl (at least partially).
The program will be processing millions of messages that contain a set of 9 digits where each digit may have a value of 1-9. For instance, it may contain (1, 7, 3, 3, 9, 5, 6, 1, 2). It is critical that all messages that contain the same set need to be stored together.
Unfortunately, the set may contain an error (think typo). If a set doesn't match any previously seen sets exactly, the program needs to determine if this should be a new set or if it belongs to a previous set. Assume that I have a perfect way of doing this if I have two messages side by side, what I am looking for is a fast/cheap way to identify candidate sets.
In other words, I can't compare each set to every previous set. What I want to be able to do is very quickly/cheaply identify some candidates that are worth the time to do an expensive message to message compare. Here are the types of things I want to allow for:
Any change to the order (1,2,3,4,5,6,7,8,9 instead of 9,8,7,6,5,4,3,2,1) AND/OR 1 of the following:
Exactly 1 insertion (10 digits instead of 9) OR
Exactly 1 deletion (8 digits instead of 9) OR
Exactly 1 transformation (7 instead of a 5)
If I were just going with the first one, it would be simple. Sort/concatenate the list and perform a hash lookup.
I am sick with a pretty bad head cold so I am going to assume I have done a poor job of explaining. I apologize in advance. Here are some of the ideas I have came up with that I don't think will work:
Using a range of the product of the set
Using a range for the average and deviation of the set
Using a range for the "distance" to another 3rd hardcoded set
Fast and cheap but without too many false positives - ideas?
I wrote a script that uses Getopt::Long to get the command line arguments. Is there a way to allow the user to use “!=“ in addition to "=“ so the user could for example request data not equal to year 2016 or data equal to year 2016?
I've written the above script to modify the various attributes of "item" and "data" element. when I try to run this script it is not showing any error but not performing the required actions. it is not going inside the loop "if($a eq $c)" and simply printing all the names ignoring this loop . any suggestions about what is the bug in this script and how I can handle it?:
I've written this code but the modifications are not reflecting in the xml file.am I missing something important in the code? confused about using perl in xml! would be glad if someone can help and explain in a detailed manner how to perform this task? I am getting output as Joey 67890
my $parser=new XML::DOM::Parser;
my $doc=$parser->parsefile('C:\perl\perl_tests\xmlin.xml') or die$!;
foreach my $address(@address)
if($address->getAttribute("name") eq "tayal")
XML FILE : <config logdir="var/log/foo/" debugfile="tmp/foo.debug">
<server name ="sahara" osname ="solaris" osversion="2.6">
<address name="ankit" id="70888"/>
<address name="tayal" id="70889"/>
<server name="gobi" osname="irix" osversion="6.5">
<address name="anshul" id="70689"/>
<server name="kalahari" osname="linus" osversion="2.0.34">
<address name="raghu" id="45678"/>
<address name="lucky" id="67895"/>
What i want to do is use Getopt::Long module and make a flag --unique so that I can feed any value to that flag let's say 2 or 4 or 10 etc and it prints the line fulfilling the condition. How can I do that?