Hi t-rex,
I can't reproduce the issue with the code you showed. I tested with both the original code you posted (with dummy values inserted for the missing variables) and the following boiled down version.
my $inp = <<'END'; <%= my $capi = 'foo'; $capi; %> <%= my $marega = 'bar'; $marega; %> END while($inp =~ /<%=(.*?)%>/s) { print "Dollar 1 before eval = $1\n"; $inp =~ s/<%=(.*?)%>/eval $1/es; print "INP after substitution = $inp\n"; } __END__ Dollar 1 before eval = my $capi = 'foo'; $capi; INP after substitution = foo <%= my $marega = 'bar'; $marega; %> Dollar 1 before eval = my $marega = 'bar'; $marega; INP after substitution = foo bar
Please try to boil down your problematic code into a Short, Self-Contained, Correct Example that reproduces the problem.
Perhaps if (@{$ctxt{'capi_devices'}}) is false, and that's why the $capi output is not showing up? (Although based on your sample output that wouldn't fully explain why that code block is skipped - your sample output appears to show only one iteration of the loop.)
You could try to insert debugging warn statements at strategic places to see what does and doesn't get executed. See also the Basic debugging checklist.
Regards,
-- Hauke D
In reply to Re: Regex error in the second last string
by haukex
in thread Regex error in the second last string
by t-rex
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |