#The first thing I want to do is to be able to call the function from the command line along with the name of the file to parse followed by the keyword to isolate. $FileName=shift; $String=shift; #Then I would open the file to parse before going any further open(INFILE, $FileName) or die "Cant open the file\n"; #Then I think I should convert the file to a list to parse @file=; #Then I guess I would do something like the following #While reading in from the file while() { #Save the contents of EACH line $TheLine = $_; #Then I would search through each element of the line foreach $x (@file) #or $TheLine { #Then I would check to see if the string entered on the command line exists in the line (which it always will because I will know which SQLs e.g. delete, update, etc...I am searching for in the file) if(exists $TheLine{$String}) { #Then I want to delete (or replace) everything BEFORE the keyword $String with a blank.....basically meaning erase it. This is where I am absolutely lost at because I don't know of a relatively easy way to do this. I figured I would use the S// operator something like s/.*$String//g #Basically do something like that #This would leave only the String I was looking for FOLLOWED by the rest of the line. }#end if