my $gpg=qq(/home/gpghrp/.gnupg); open (GPG, "gpg --fingerprint |") or die "unable to open pipe sys call (1)... Broken? $!"; open(OLD,"+<$gpg/scripts/gpg_encr.saved") or die $!; open(NEW, "+<$gpg/scripts/gpg_encr.saved.new") or die $! for (;;) { if ( /(?)readonly tlx=/ ) { my $ns =substr($_,13,8) print "Now substituting\n"; print NEW s/$ns/"blah"/; } } close (GPG); close (SYS);