|
|
|
|
|
|
|
|
|
#6 |
|
Remember to rebel against the authorities, kids!
Join Date: Aug 2003
Location: AU
Posts: 406
|
Thanks for that Chris - will look into it.
This is actually the way that I'm using it at the moment: Obviously it's just an example, but I've seen odd behaviour when data from either array has regex or pattern type characters in them. Code:
#!/usr/bin/perl -w
## This Array is the orginal data to be searched:
## Data in here may have regex / pattern characters.
open (FH, "$WorkingDir/FILENAME");
while (<FH>)
{
chomp $_;
push(@Data_Array, "$_");
}
close (FH);
## This Array contains the things we want to look for
## in the Data_Array:
## Data in here may have regex / pattern characters.
open (FH2, "$WorkingDir/FILENAME");
while (<FH2>)
{
chomp $_;
push(@Look_For_Array, "$_");
}
close (FH2);
foreach $Data_Array(@Data_Array)
{
foreach $Look_For_Array(@Look_For_Array)
{
if ($Data_Array =~ /$Look_For_Array/i)
{
$Data_Array =~ s/$Look_For_Array/$Something_Else/gmi;
}
}
}
# Quote and Quote-like Operators # Regexp Quote-Like Operators & using q somewhere may be the answer?
__________________
XXX Porno Hardcore |
|
|
|
|
|