Ok, so you munged a bunch of data into a code block and expect that we will do the work to pick it apart and solve your problem for you. But you still haven't shown what you get when you run your script using the data you provided nor told us what you would like to see instead. So much for providing us the information we need to help you solve your "urgent" problem!
Actually, I did pick apart your data and inserted it into the sample script I provided above. The modified script is:
#!/usr/bin/perl
use strict;
use warnings;
my $vldb = <<VLDB;
JOINTS AND COMMITMENT
JOINTS AND cOMMITMENT (PRESCRIBED FORMAT) REGULATIONS, Map. 21
+1, Regulation 1
PRACTICAL ORDER
COMMITED PLACES ORDER, Map. 213, Order 1
COMMITMENT OF COMPETENT AUTHORITY, Map. 213, Notification 1
COMMITED OF COMPETENT AUTHORITY, S 417/1998
COMMITED PLACES ORDER 1997, S 276/2000
JOINTS AND OPTICIANS
JOINTS AND OPTICIANS (REGISTRATION AND PRACTISING CERTIFICATES) R
+EGULATIONS, Map. 213A, Regulation 1
JOINTS AND OPTICIANS (INVESTIGATION OF COMPLAINTS) REGULATIONS,
+ Map. 213A, Regulation 2
JOINTS AND OPTICIANS (PRACTICE, CONDUCT, ETHICS AND PUBLICITY) RE
+GULATIONS, Map. 213A, Regulation 3
JOINTS AND OPTICIANS (EXEMPTION FROM SECTION 25(1)) ORDER, Map
+. 213A, Order 1
JOINTS AND OPTICIANS (COMMENCEMENT) NOTIFICATION 2008, S 89/2
+008
VLDB
my $leap = <<LEAP;
Joints and Commitment
Practical Order
Commitment of Competent Authority, Cap. 213, N 1
Commited Places Order, Cap. 213, OR 1
Prohibited Places Order 1997, S 276/2000
committed Places Order 2001, S 538/2010
Joints and Opticians
Joints and Opticians (Exemption from Section 25(1)) Order, Map
+. 213A, OR 1
Joints and Opticians (Exemption from Section 25(1)) Order 2008,
+ S 91/2008
Joints and Opticians (Investigation of Complaints) Regulations,
+ Map. 213A, RG 2
Joints and Opticians (Practice, Conduct, Ethics and Publicity) Re
+gulations, Map. 213A, RG 3
Joints and Opticians (Registration and Practising Certificates) R
+egulations, Map. 213A, RG 1
Joints and Opticians (Registration and Practising Certificates) R
+egulations 2008, S 90/2008
Joints and Opticians (Registration and Practising Certificates) R
+egulations 2008, S 90/2008
Joints and Opticians (Commencement) Notification 2008, S 89/20
+08
Joints and Opticians (Commencement) Notification 2008, S 89/20
+08
LEAP
open my $vldbIn, '<', \$vldb or die "Can't open vldb: $!\n";
open my $leapIn, '<', \$leap or die "Can't open leap: $!\n";
my @leapStrings = <$leapIn>;
chomp @leapStrings;
close $leapIn;
my @vldbStrings = <$vldbIn>;
chomp @vldbStrings;
close $vldbIn;
for my $leapString (@leapStrings) {
print $leapString;
$leapString =~ s/^\s+|\s+$//g;
my $found;
for my $vldbString (@vldbStrings) {
$vldbString =~ s/^\s+|\s+$//g;
$vldbString =~ s/Notification\s+(\d+)$/N $1/g;
$vldbString =~ s/Order/OR/g;
if ($leapString =~ m/$vldbString/i) {
$found = 1;
last;
}
}
if ($found) {
print "\t FOUND IN VLDB =====\n";
} else {
print "\t NOT FOUND IN VLDB =====\n";
}
}
which prints:
FOUND IN VLDB =====
Joints and Commitment FOUND IN VLDB =====
NOT FOUND IN VLDB =====
Practical Order FOUND IN VLDB =====
NOT FOUND IN VLDB =====
Commitment of Competent Authority, Cap. 213, N 1 NOT FOUND
+ IN VLDB =====
Commited Places Order, Cap. 213, OR 1 NOT FOUND IN VLDB ==
+===
Prohibited Places Order 1997, S 276/2000 NOT FOUND IN VLDB
+ =====
committed Places Order 2001, S 538/2010 NOT FOUND IN VLDB
+=====
NOT FOUND IN VLDB =====
Joints and Opticians FOUND IN VLDB =====
NOT FOUND IN VLDB =====
Joints and Opticians (Exemption from Section 25(1)) Order, Map
+. 213A, OR 1 FOUND IN VLDB =====
Joints and Opticians (Exemption from Section 25(1)) Order 2008,
+ S 91/2008 FOUND IN VLDB =====
Joints and Opticians (Investigation of Complaints) Regulations,
+ Map. 213A, RG 2 FOUND IN VLDB =====
Joints and Opticians (Practice, Conduct, Ethics and Publicity) Re
+gulations, Map. 213A, RG 3 FOUND IN VLDB =====
Joints and Opticians (Registration and Practising Certificates) R
+egulations, Map. 213A, RG 1 FOUND IN VLDB =====
Joints and Opticians (Registration and Practising Certificates) R
+egulations 2008, S 90/2008 FOUND IN VLDB =====
Joints and Opticians (Registration and Practising Certificates) R
+egulations 2008, S 90/2008 FOUND IN VLDB =====
Joints and Opticians (Commencement) Notification 2008, S 89/20
+08 FOUND IN VLDB =====
Joints and Opticians (Commencement) Notification 2008, S 89/20
+08 FOUND IN VLDB =====
What do you expect to see?
True laziness is hard work
|