http://www.perlmonks.org?node_id=789709


in reply to Re: Delete till end of line to another string
in thread Delete till end of line to another string

Not really.

If there is a line in the input data that has neither a > or a { it will produce a wrong result.

use strict; use warnings; while (<DATA>) { $_ =~ m/\{/g; my $str = $`; my $str1=$'; $str=~ s/\>//g; print $str."{".$str1; } __DATA__ testline1 EVITE LA ENFERMEDAD PERIODONTAL< EVITE LA ENFERMEDAD PERIODONTAL< AS {IT}CTIQUE LA HIGIENE DENTAL PARA CUIDAR SUS ENCĂ testline2 testline3
produces the output
Use of uninitialized value in substitution (s///) at ... Use of uninitialized value in concatenation (.) or string at ... <snip other warnings> {{{{IT}CTIQUE LA HIGIENE DENTAL PARA CUIDAR SUS ENCĂ <snip more warnings> {IT}CTIQUE LA HIGIENE DENTAL PARA CUIDAR SUS ENCĂ <snip more warnings> {IT}CTIQUE LA HIGIENE DENTAL PARA CUIDAR SUS ENCĂ

cheers, si_lence

I apologize for the lack of exclamation marks in this post