Pelp wrote:
> 
> Hi -

Hello,

> The problem is that I'm unable to save my changes after making
> subsitutions, and I don't understand why.
> 
> Here's the code.
> 
> --
> 
> #!/usr/vendor/bin/perl
> use strict;
> use IO::File
> 
> my $FRAME_FILE = new IO::File;
> my $change_on  = "FChangeBar Yes";
> my $change_off = "FchangeBar No";
> 
> $FRAME_FILE -> open("+<test.mif") or die "can't open file";
> 
> while (<$FRAME_FILE>)
> {
>    if (/$change_on/)
>    {
>       s/$change_on/$change_off/g;
>    }
> }
> 
> $FRAME_FILE -> close;


Here is one way to do it:

#!/usr/vendor/bin/perl -w
use strict;
use Tie::File

my $change_on  = qr/FChangeBar Yes/;
my $change_off = 'FchangeBar No';
my @data;

tie @data, 'Tie::File', 'test.mif' or die "Cannot tie 'test.mif': $!";
s/$change_on/$change_off/g for @data;
untie @data;

__END__



John
-- 
use Perl;
program
fulfillment

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

Reply via email to