473,320 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

string condition file - lookup logic

Hello - looking for an efficient way in perl (been a while) to use a
control file to pass or fail strings submitted to a perl program.

I have a flat file allow.txt in the following format. It does not have
to be in this format, it can be in regex format - and maybe should be.

f1 -+f2 -+f3 -+f4 -+f6 ...

records in the file may look as follows (for example)

xx5 -j7 -j8 +g2 +j8
xx4 +j7
gg5
xx7 +j7 -xs2 -557

Each record may have one of more columns, where starting with the
second column the value is to be labled an "and" or a "not" (+ or -)

The + = must have this parm , the - = can't have this parm (again,
might make sense to format the file in regex)

using very simple perl program below, I'd like to bounce off the
allow.txt file and display "rejected" if arugments passed comply, and
"passed" if they do. My first inclination is to load the control file
into a table and build lookup logic - but wanted to try the listgroup
to

test.pl:

#!/usr/bin/perl
use warnings;
use strict;
my $a1 = shift @ARGV;
print $a1;
so for example

perl test.pl gg5
"passed" (because no parms on file)

perl test.pl xx7 j7 j8
"passed" (because had the j7)

perl test.pl xx7 j8
"failed" (because did not have the j7)

perl test.pl xx5 g2
"failed" (because did not have the j8)

perl test.pl xx5 g2 j8 j7
"failed" (because had j7)

If the solution will be easier by just formating the control file in
(regex) condition format and somehow then testing the arguments
against the file that would be ideal.

Thanks for any help or information.
Jul 19 '05 #1
0 3308

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Chris S. | last post by:
I have a number of strings, containing wildcards (e.g. 'abc#e#' where # is anything), which I want to match with a test string (e.g 'abcdef'). What would be the best way for me to store my strings...
0
by: Richard | last post by:
Hi, I'm suffering a socket race condition - I think. The code works fine at full speed on a single CPU machine. However when I run full speed on a 2 Zeon machine the socket drops data on an...
17
by: Chad Myers | last post by:
I've been perf testing an application of mine and I've noticed that there are a lot (and I mean A LOT -- megabytes and megabytes of 'em) System.String instances being created. I've done some...
11
by: Darren Anderson | last post by:
I have a function that I've tried using in an if then statement and I've found that no matter how much reworking I do with the code, the expected result is incorrect. the code: If Not...
5
by: jimc52 | last post by:
Hello Everyone: I am hoping one of the gurus here will give me some help. I have designed a form with some check boxes. I put the checkboxes there on the form so later I could use them as flags on...
2
by: Jakub Bednarczuk | last post by:
Hi everybody I am trying to find the solution for the problem stated in the topic, but so far without any result. Let's see the problem. I have set of conditions and the description (logical...
7
by: pbd22 | last post by:
Hi. I really need some advice on fine-tuning a stored procedure that is the meat of the search logic on my site. Customers are allowed to save searches, which dumps the search logic in a table...
0
by: Robert Bossy | last post by:
python@bdurham.com wrote: (3) is the securest way since the input file cannot induce unexpected behaviour. With this respect (1) is a folly and (2) is a good compromise since you still can write...
12
by: Eric Kaplan | last post by:
I have a function like this ============= bool Table::Get(char* FieldName, char* FieldValue) and I call the function like the follow ============= while(!tbl.ISEOF()) { char id2;...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.