in reply to Doubt in Eval

$a and $b are special variables in Perl, so you want to use some other letter for your variable. You've noticed that when you do an eval, the print is "invisible"; however there is a way to get around that. Use Devel::Eval.
#!/usr/bin/perl -l use strict; use warnings; use Devel::Eval qw( dval ); my $x = ''; dval <<'EOF'; if ($x= 5) { get_accounts(); } sub get_accounts { print $x; } EOF

Replies are listed 'Best First'.
Re^2: Doubt in Eval
by chromatic (Archbishop) on Feb 16, 2012 at 22:10 UTC
    You've noticed that when you do an eval, the print is "invisible"; however there is a way to get around that.

    What does Devel::Eval do in this case? There's no string eval in the original code; you changed the exception handling code to do something completely different! The real problem is one of lexical scoping.

      Thanks Every one .. I will use Strict in my programs.