David Vd Geer Inhuur Tbv Iplib wrote at Mon, 27 May 2002 16:59:24 +0200:

> open(FH, "<$file");
>   while <FH> {
>     s/(/(\n    /g
>     s/\n)/)/g
>     push @newoutput
>   }
> close FH;
> 
> open(HH, ">$file");
> print HH @newoutput;
> close HH;
> 
> 
> It's untested, you might need to add some backslashes in front of the substitutions 
>but this
> should be it. There is probably someone else that does it faster, but at least I 
>tried :)
> 

That won't be the only problem.
There are at least two ';' missing and 
it could be better to mention the $_ in the push command.

# Don't forget to check for errors
open FH, "<$file" or die "Can't open $file";
while (<FH>) {
    s%\(%\(\n     %g;
    s%\n\)%\)%g;
    push @newoutput, $_;
}
close FH;

...

(I also changed the s/// statement to s%%% to increase the readability).

Greetings,
Janek


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

Reply via email to