http://www.perlmonks.org?node_id=812253


in reply to command line history?

Perhaps you should check what error you got!
$ perl -e'print `history` // die($? == -1 ? $! : "\$?=$?")' No such file or directory at -e line 1.

history is a shell command. Just like you can't execute a line of Perl code without loading Perl, you can't execute a line of sh code without loading sh. Here's how you can do that:

$ perl -e'sh -c print `history` // die($? == -1 ? $! : "\$?=$?")' $

Unfortunately, that doesn't print anything either. But that's the shell doing that:

$ sh -c history $

I tried a few things quick, but they didn't work. How to fix is is beyond my knowledge and it has nothing to do with Perl. Consult your shell's documentation.