pldev has asked for the wisdom of the Perl Monks concerning the following question:

In the below code why the output is not as expected. When I execute command for the first time im getting the correct output. Incase if it execute again it put some junk in front. Below is code for your reference

$ perl -pe "print $_;" Bar.pm USE STRICT; USE WARNINGS; PACKAGE BAR; =BEGIN DEBUGGING DIE 'BAR DIES'; =CUT 1; -bash-4.1$ perl -pe "print $_;" Bar.pm BarpmUSE STRICT; BarpmUSE WARNINGS; BarpmPACKAGE BAR; Barpm=BEGIN DEBUGGING BarpmDIE 'BAR DIES'; Barpm=CUT Barpm1;
Could you anyone advise why this happen like this? Additonal information if I use clear command then again im getting correct output for the first time. But second time onwards without clear command it adds junk again in front of each line :(

Replies are listed 'Best First'.
Re: perl command line
by JavaFan (Canon) on Feb 25, 2012 at 08:37 UTC
    $_ gets interpreted by the shell. Use single quotes instead of double quotes.
      Yes. It works. Thanks for information.
Re: perl command line
by Anonymous Monk on Feb 25, 2012 at 08:51 UTC