perl -e "print 'Hello World';"
However, whenever I was trying any assignment, it was not working. For example,
perl -e "$k = 'Hello World';print $k;"
did not work. I later came to know it was because bash was gulping $k because I had used a double-quoted string. Using a single-quoted string works fine.
perl -e '$k = "Hello"; print $k;'
A quick search showed that I can use Devel::REPL for this purpose. So, I obtained it from CPAN.
cpan -i Devel::REPL
I prefer using the Perl REPL interpreter using the re.pl script.
[blog@domain ~]$ re.pl
$ my $k = "Hello World"
Hello World$ print $k;
1$ Hello World