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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: perl in line editing help
by Corion (Patriarch) on Aug 27, 2013 at 11:27 UTC | |
|
Re: perl in line editing help
by Eily (Monsignor) on Aug 27, 2013 at 12:20 UTC |