[Cascavel-pm] Perl shell
Daniel Ruoso
daniel em ruoso.com
Quarta Maio 24 13:55:40 PDT 2006
Em Qua, 2006-05-24 às 17:43 -0300, Flavio S. Glock escreveu:
> Escrevi este programa para responder uma pergunta no IRC - ele permite
> a execução passo a passo de comandos Perl:
>
> use strict; use warnings;
> my $b = '; print "\n>> "; my $s = <>; eval $s . $b; ';
> eval $b;
Apenas para registro, foi muito engraçado:
* ruoso just run in the shell: my $a = 1; my $b = 2; oops, the shell is
out...
<fglock> ruoso: there seems to be a problem specific to '$b' in Perl 5
<ruoso> heh
<fglock> print $@ shows 'Can't use string ("1") as a symbol ref while
"strict refs" in use' - but this only happens with '$b'
<ruoso> fglock, duh... you do eval '$b'... but $b now is "1" and no more
"print ">>"; ..."
<fglock> oh, it's because $b is the main program :)
<fglock> heh
<ruoso> heh
<ruoso> fglock++
<ruoso> heh
daniel
Mais detalhes sobre a lista de discussão Cascavel-pm