use strict; use IO::File; my $in = IO::File->new; my $out = IO::File->new; my $change_on = "FChangeBar Yes"; my $change_off = "FchangeBar No"; # hmmm, lower case c? $in->open('test.mif') or die "can't read input"; $out->open('>tmp.mif') or die "can't write output"; while (<$in>) { s/$change_on/$change_off/g; print $out $_; } $in->close or die "can't close input"; $out->close or die "can't close output"; rename('tmp.mif','test.mif') or die "can't rename"; #### use strict; use Tie::File; my @file; tie @file, 'Tie::File', 'test.mif' or die "cannot tie file"; s/(FchangeBar )Yes/$1No/g for @file;