I have a file that I want to run multiple actions on. First, the file is read in as one long string. I want to
substitute some words with others so I run a substitution. That seems to change the data in the first
while, HOWEVER, when I run the second while loop on the same data to parse my newly reformated file, I get the original file, instead of the newly reformated file. . .


Something like the code I'm using:
-----------------------------
open(SOURCE, $file);
###Run a substitution that breaks up my string into lines
while (<SOURCE>) {
    s/something/\nsomething/g;

}
#What I want it to parse a file, which at this point, shoud consist of multiple lines.
#HOWEVER problem is I amI running this command on the same file


while (<SOURCE>) {
  parse SOURCE;
}

----------------------------------------------
Is the best thing to save the outcome of the substitution into a variable and read that variable in on the
second while or is there an easier way? Thanks in advance for the help :)


-T

e.g.

while (<SOURCE>) {
    $newFile = s/something/\nsomething/g;
}
#does this even work?

while ($newfile) {
   parse stuff ;
}

_________________________________________________________________
Instant message with integrated webcam using MSN Messenger 6.0. Try it now FREE! http://msnmessenger-download.com



-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to