#!/usr/bin/perl -w use strict; my $file = "/var/www/html/acs/new/index.html"; my $file_bu = "/var/www/html/acs/new/index_bu.html"; open (FILE, "+<$file") or die "Can't open file: $!"; open (FILE_BU, ">$file_bu") or die "Can't open file: $!"; # Save a back up of the original file my @file = ; #print "@file\n"; print FILE_BU "@file"; close FILE_BU; # Convert file to string for search and replace my $string = do {local $/; }; if (defined $string) {print "defined\n"}; print "$string\n"; close FILE;