On 7/20/07, Mr. Shawn H. Corey <[EMAIL PROTECTED]> wrote:
Chas Owens wrote:
> There are also some Perl REPLs* out there that allow you to use a Perl
> interpreter interactively.
>
> zoidberg, a Perl shell:
> http://search.cpan.org/~pardus/Zoidberg-0.95/lib/Zoidberg.pm
> psh, another Perl shell: http://sourceforge.net/projects/psh/
> Devel::REPL, a modern Perl REPL:
> http://search.cpan.org/~mstrout/Devel-REPL-1.001000/lib/Devel/REPL.pm
>
> There are probably others out there.
>
> * REPL stands for Read, Eval, Print, Loop.
>

Oh, you mean:

   perl -ple '$_=eval'

Or on DOS:

   perl -ple "$_=eval"
snip

Nope, take a look at this:
[EMAIL PROTECTED]:~$ perl -ple '$_=eval'
my $c = 5
5
$c+1
1
Now this:
pugs> my $c = 5
5
pugs> $c + 1
6

The problem is that "my $c = 5" creates a lexical inside the while
loop created by -p and it goes out of scope immediately.  Also, REPLs
tend to provide more services (such as command line completion,
command history, ability to save the current buffer, etc.).  As you
can see, Perl 6 already has a REPL.  Of course, Pugs* is a lot more
than just a REPL, it is also a compiler for the Parrot virtual
machine** and it can interpret the code directly (like perl does
currently).

* http://www.pugscode.com
** http://www.parrotcode.org

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to