open(MF, "MyFile.txt"); while(defined($line=<MF>)){ if($line =~ /\<br\>/ig){ $line =~ s/\<br\>/\r/; } }
it might be ugly, but it should work. NuTs ----- Original Message ----- From: "Ricci, Mark" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, May 30, 2003 11:04 AM Subject: Global substitution > Hello All, > > I have a file that has <br> characters instead of carriage returns. > I'm having a hard time coming up with an automated search and replace > script. > > Any ideas would be appreciated... > > Mark > > #!c:\perl\bin -w > use strict; > > > my $infile = "text.txt"; > My $outfile = "results.txt"; > open(DATA, "<$infile"); > open(OUTDATA, ">$outfile"); > my %counts; > while (<DATA>) { > #### pull in data and replace <br> with a carriage return > $data =~ (/(\S+)/g); > #### assign the new DATA to a variable > my $newdata = $data; > print OUTDATA "$newdata\n"; > } > Close DATA; > Close OUTDATA; > > > This e-mail message is for the sole use of the intended recipient(s) and may > contain confidential and/or privileged information. Any review, use, > disclosure or distribution by persons or entities other than the intended > recipient(s) is prohibited. If you are not the intended recipient, please > contact the sender by reply and destroy all copies of the original message. > Thank you. > > WordWave, Capturing the Power of the Spoken Word > http://www.wordwave.com > > > _______________________________________________ > Perl-Win32-Users mailing list > [EMAIL PROTECTED] > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs