Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > string condition file - lookup logic

Thread Tools

string condition file - lookup logic
Posts: n/a
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
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

use warnings;
use strict;
my $a1 = shift @ARGV;
print $a1;

so for example

perl gg5
"passed" (because no parms on file)

perl xx7 j7 j8
"passed" (because had the j7)

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

perl xx5 g2
"failed" (because did not have the j

perl 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.
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with while condition OR condition Bill W. Ruby 13 05-09-2011 09:42 PM
Python Logic Map/Logic Flow Chart. (Example Provided) spike Python 8 02-09-2010 12:31 PM
Asynchronous Logic Gates and Analog Logic Gates Jyoti Ballabh Software 3 11-26-2009 06:48 PM
Condition outside loop or separate loop for different condition? - Java 12 06-15-2005 08:50 AM
Lookup in std::map<string,string> doesn't work gipsy boy C++ 1 01-12-2005 03:16 PM