Greenguy's Board


Go Back   Greenguy's Board > Programming & Scripting
Register FAQ Calendar Today's Posts

 
 
Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
Old 2006-10-12, 09:10 PM   #6
Jeremy
Remember to rebel against the authorities, kids!
 
Jeremy's Avatar
 
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;
		}
	}
}
Maybe I should be looking in Perl OP at:
# Quote and Quote-like Operators
# Regexp Quote-Like Operators

& using q somewhere may be the answer?
__________________
XXX Porno Hardcore
Jeremy is offline   Reply With Quote
 


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

Forum Jump


All times are GMT -4. The time now is 04:55 PM.


Mark Read
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc