in reply to Re: how to remove block of data from file based on string
in thread how to remove block of data from file based on string

ya, this is what I want.......
  • Comment on Re^2: how to remove block of data from file based on string

Replies are listed 'Best First'.
Re^3: how to remove block of data from file based on string
by Anonymous Monk on Mar 15, 2012 at 01:27 UTC
    Here is your solution:
    my $str = <<'EOB'; start hehu7 gjwsdh hsjdhj remove hjhsj jdkwj hwjdhjwh end start crgr hjdhwjd wjdkwj wkjw g hjhd end EOB while ($str =~ /(\bstart\b.*?\bend\b\s*)/gs) { my $block = $1; if ($block =~ /\bremove\b/) { $str =~ s/\Q$block\E//; } } print $str; __END__ start crgr hjdhwjd wjdkwj wkjw g hjhd end
    A reply falls below the community's threshold of quality. You may see it by logging in.