in reply to Re: Problem changing only first occurrance of pattern in file
in thread Problem changing only first occurence of pattern in file

Don't forget to make the back-up file and also verify that the file was opened correctly:   :-)
use Tie::File; use File::Copy; my $file = 'user.txt'; copy $file, "$file.bak" or die "Cannot copy '$file' $!"; tie my @file, 'Tie::File', $file or die "Cannot open '$file' $!"; for ( @file ) { s/\|No$/|Yes/ and last; }