# DynInterp.pm package DynInterp; use overload '""' => 'stringify'; sub new { my $class = shift; bless [@_], $class; } sub stringify { my $this = shift; return join('', map { ref($_)eq'SCALAR'?$$_:ref($_)eq'ARRAY'?"@{$_}":$_ } @$this); } 1; #### # --------------------- # dyninterp.pl #!/usr/bin/perl -l use DynInterp; $x = new DynInterp('the value of $y is ', \$y, '.'); $z = new DynInterp('the value of $y is ', \@y, '.'); $y=5; print $x; $y=8; print $x; @y = qw(a b c d); print $z; $"=','; print $z; $"='.'; print $z; #### $var = new DynInterp('date ', \$date); $date = localtime; print $var; #### $"=$,,$_=q>|\p4<6 8p .q>.<4-KI;$, .=pack'N*',"@{[unpack'C*',$_] }"for split/