On Tue, Jun 19, 2001 at 11:33:27AM -0400, Brandon Barker wrote:
> I'm having trouble writing a script that will remove the regular 
> expression "<B>" in a text file in macperl.  At first I thought I was 
> making a programming mistake but I tried the same script in Linux and it 
> worked as expected; in macperl the <B> will be removed but every line 
> after the first will be deleted in the output file.  I've included the 
> code as well as the droplet and a sample input file "funerals" in this 
> email.
> 
> #!/usr/bin/perl -w
> {
>     foreach $inFile (@ARGV) {
>         open (INNEWSFILE, $inFile);
>         open (OUTTEXTFILE,">".$inFile.".txt");
> 
>         $newsFile = <INNEWSFILE>;
>         $newsFile =~ s/<B>//g;

You're only reading the first line of the file.  Try:

local $/;

to set the input record separator to undef to read the whole file at once.

If the files are really big reading one line at a time in a loop might be
better though.

Ronald

Reply via email to