Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
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

Comment on how to do repalce single line no repetition?
Download Code
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 the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (8)
As of 2014-07-29 22:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (229 votes), past polls