Input File -------------------------- this is a test [[ this is a test ]] this is also a test [[ this is also a test ]] Output -------------------------- this is a test this is also a test Code -------------------------- #!/usr/bin/perl -w use strict; open(FILE, ") { $_ =~ s/\[\[[^\]]*\]s*\]/ /msg; print; } close(FILE);