open my $input, '<', $ARGV[0]; open my $output,'>', $ARGV[1]; while (my $sentence = <$input>) { my $substring = 'clothes.*?mall'; $sentence =~ read-only{$substring}; print $output , $sentence; }