#!/usr/bin/perl # Always use these use strict; use warnings; # Edit contains the complete path of the files to be edited my $path = "/home/rjs/heena/edit" ; # Getting a file handler (and test for success/failure!) open(FL, "<", $path) or die "unable to open data file '$path' ($!)\n"; # Getting all the file names in the @array so that i can process the # file one by one chomp(my @array = ); # Close the data file close(FL); # Process each file foreach my $file (@array) { next if ($file =~ /^\s*$/); # Skip blank lines from datafile open(FILE, "<", $file) or die "unable to open file '$file' ($!)\n"; while() { s/CONFIDENTIAL(.*?)own\s+risk/ /sm; print; } close(FILE); }