#!/usr/bin/perl -w #opening Rules1.txt for reading open(FILE, "; #closing the file handle close(FILE); #im looping so that i can replace with what im looking for foreach $line (@array) { $line =~ s##/*#ig; $line =~ s##*/#ig; } #again open for writing open(FILE, ">Rules1.txt") or die "unable to open Rules1.txt: err at $!"; #write to FILE print FILE @array; #close FILE close (FILE);