e - evaluate the right-hand side as an expression
ee - evaluate the right side as a string then eval the result
input.pl file:
#!/usr/bin/env perl
my $code = 'rand';
my $str = 'a b c';
$str =~ s/b/$code/exe;
print "$str\n";
I used “exe” instead of “xee” or “eex” on purpose. It should be able to parse it correctly (none of these are currently working).
Now, this code reveals the problem:
#!/usr/bin/env perl
use Data::Dumper;
use PPI;
my $Document = PPI::Document->new('input.pl');
my $sub_nodes = $Document->find('Token::Regexp');
print Dumper($_->{modifiers}) for @$sub_nodes;
Output:
$VAR1 = {
'x' => 1,
'e' => 1
};
There is no information about second e.
This means that I have to do extra processing of the original string in order to deal with this problem.
perlre:
input.pl
file:I used “exe” instead of “xee” or “eex” on purpose. It should be able to parse it correctly (none of these are currently working).
Now, this code reveals the problem:
Output:
There is no information about second
e
.This means that I have to do extra processing of the original string in order to deal with this problem.