Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

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

by si_lence (Deacon)
on Aug 19, 2009 at 07:06 UTC ( #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


Comment on Re^2: Delete till end of line to another string
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://789709]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (9)
As of 2014-09-02 19:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (29 votes), past polls