Perl comes with a built-in debugger that can be invoked by passing the -d flag to perl.

The default Term::ReadLine that comes with Perl does not provide history (pressing the up arrow) in the debugger.

You need to install Term::ReadLine::Gnu for that.

Probably the best way to install a Perl module is to use cpanm.

cpanm Term::ReadLine::Gnu

If the above does not work check how to install Term::ReadLine::Gnu.