This will identify bracketed expressions in sentence 2 and bracket them in sentence 1.
(update: removed unnecessary if)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;
In reply to Re: Merging in perl
by fod
in thread Merging in perl
by cthar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |