ghosh123 has asked for the wisdom of the Perl Monks concerning the following question:
Hi ,
In my perl file, I want the print statements to happen only if a ENV variable is set to 1. So I want to to edit all the print statements (dumping to a file)which are there in my file.
My print statements look like :
print FP "this is name",$self->{name}, "\n";
print FP "this is second line\n";
I am trying with the following command but it is not working,
perl -i.bak -p -e s/^print(.*);$/print$1\sif$ENV{DEBUG};/g my_perl_file
Back to
Seekers of Perl Wisdom