Perl unlike its successor, it does not natively has hte REPL (READ, Evaluate, Print, Loop) interface to perl . so it does not suppport something like in Python where you can type something or getting help to play with some idea and then put them into code.
"How can I start an interactive console for perl": people has discussed some ideal on the REPL., one of hte suggestion here is to write some code as follow
#!/bin/perl
use Carp;
while (<>) {
chomp;
my $result = eval;
print "$_ = $result\n";
}
However, this is not a elegant solutoin, if you you really want to have REPL in perl, you may looks at
Dave Rolsky: stackoverlow 写道
Not only did Matt Trout write an article about a REPL, he actually wrote one - Devel::REPL
本文详细阐述了Perl语言相较于其后继者在REPL(Read-Evaluate-Print-Loop)交互环境中存在的不足,并提供了一个实用的替代方案。通过使用自定义脚本来实现类似Python REPL的功能,允许用户在Perl中进行实验性编程,从而提高开发效率和代码理解能力。
161

被折叠的 条评论
为什么被折叠?



