$ cat foo.pl #!/usr/bin/perl -w ################## open(OUT,">testfileA"); print OUT "This is testfileA\n"; close(OUT); open(OUT,">testfileB"); print OUT "This is testfileB\n"; close(OUT); open(IN,"/tmp/testfileA"); rename ("testfileB", "testfileA"); print ; close IN;