Please go through following code.
#! /usr/bin/env perl use strict; use warnings; use 5.0080; my $html =<<'HTML'; <div> <p>Code</p> <?perl print "<b>Hello World</b>"; ?> </div> HTML # trial 1 $html =~ s/\<\?perl(.*?)\?\>/$1/gisee; # trial 2 $html =~ s/\<\?perl(.*?)\?\>/(sub{$1})->()/gisee; print $html;
This prints the output as follows:(trial #1 or #2)
<b>Hello World</b><div> <p>Code</p> 1 </div>
But I want as follows:
<div> <p>Code</p> <b>Hello World</b> </div>
In reply to Eval in RegEx ... by thakares
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |