hi grandfather,
1. normaly not but it can happen so i load these elements from a file and read it into an array
2. yes they do everytime
3. can be 1 can be 500000
4. the minnimum matching is 4 numbers , the maximum i don't know but i never see everything larger then 14 so 20 shoud be the max
6. im loking for a single best match
here is some sample data for the array
__Array_DATA__
4930
49201
49202
49203
492041
492043
492045
492051
492052
492053
492054
492056
492058
492064
492065
492066
49208
49209
492102
492103
492104
here are some strings
4920911223344
492065577883667
49206656672
the result for these strings shoud look like
49209;11223344
492065;577883667
492066;56672
finaly my testing code wich is far from greatness ;)
use strict;
use warnings;
use File::Spec;
open(my $fh_in, '<', 'Script\\onkz.txt') or die("open failed: $!");
open(INFILE, '<', 'data.txt') or die("open failed: $!");
my @ONKZ = <$fh_in>;
my $filterregex = join('|',@ONKZ);
while (<INFILE>) {
if($_ =~ /^($filterregex)/){
print "$&;$'\n";
}
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.