Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

how to do repalce single line no repetition?

by virudinesh (Acolyte)
on Jun 03, 2013 at 09:25 UTC ( #1036701=perlquestion: print w/replies, xml ) Need Help??
virudinesh has asked for the wisdom of the Perl Monks concerning the following question:

1. am update $li (line). first am matching (table 1) and before insert <a id only

2. again match figer (table2) .

3. now i am replace this one single line

\
$li ="abbjghfg table 1 vinoth figer table2"; $f=$li; while($f=~m/table[ ]([0-9])+|table([0-9])+|fig[ ][0-9]+|fig[0-9]+/g) { $f = $'; $match_key=$&; $front=$`; $rep=$front."<aid=".$match_key.$f; print" $rep \n "; }

output come like this

abbjghfg <aid=table 1 vinoth figer table2

vinoth figer <aid=table2

single line but its print 1st match one line and after match key word print like 2 lines

am replace single line no repetition

Replies are listed 'Best First'.
Re: how to do repalce single line no repetition?
by 2teez (Priest) on Jun 03, 2013 at 10:05 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1036701]
Approved by Jim
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2017-02-21 07:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?






    Results (307 votes). Check out past polls.