Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Merging in perl

by fod (Friar)
on Dec 19, 2009 at 18:27 UTC ( [id://813542]=note: print w/replies, xml ) Need Help??


in reply to Merging in perl

This will identify bracketed expressions in sentence 2 and bracket them in sentence 1.

use strict; use warnings; my $snt1 = 'this.is.example.text'; my $snt2 = '[this.is.] [example.text]'; foreach ($snt2 =~ /\[(.+?)\]/g) { $snt1 =~ s/\Q$_\E/[$_]/; } print $snt1;
(update: removed unnecessary if)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2024-03-28 17:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found