in reply to Re^2: oneliner cat like capability
in thread oneliner cat like capability

... why is it important to have the 'n' or 'p' before the 'e'?

Per perlrun, the  -e switch expects source text to follow, either with or without a space. The switch sequence  -en means that Perl is trying to execute "n". The effect of this is made more clear with strictures enabled (see strict):

c:\@Work\Perl\monks>perl -wMstrict -en "print" foo get_bar() Bareword "n" not allowed while "strict subs" in use at -e line 1. Execution of -e aborted due to compilation errors. c:\@Work\Perl\monks>perl -wMstrict -ep foo get_bar() Bareword "p" not allowed while "strict subs" in use at -e line 1. Execution of -e aborted due to compilation errors.

Update: See jwkrahn's example here of  -pe1 which gives  -e the source 1 (that's a digit 1) to evaluate within the source code framework established by the  -p switch.


Give a man a fish:  <%-{-{-{-<