Unix Shell option '-x' in Perl

When you run the Unix shell script, you can specify the -x option so that the shell prints a valid command that is executed after all the interpolation is complete. For example, if we run this script (script.sh):

 #!/usr/bin/sh var='hello, world' echo $var 

with:

 sh -x script.sh 

we get

 + var='hello, world' + echo hello, world hello, world 

How can I get the same behavior for a perl script?

+4
source share
1 answer

Install my Devel::DumpTrace module and run

 perl -d:DumpTrace my_script.pl 
+6
source

All Articles