Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: Delete till end of line to another string

by si_lence (Deacon)
on Aug 19, 2009 at 07:06 UTC ( [id://789709] : note . print w/replies, xml ) Need Help??


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