3

On StackExchange I came across a command that looked like this:

perl -pe ...

Curious what the -pe options meant, I did man perl. This is the synopsis of that man page:

perl [ -sTtuUWX ]      [ -hv ] [ -V[:configvar] ]      [ -cw ] [ -d[t][:debugger] ] [ -D[number/list] ]      [ -pna ] [ -Fpattern ] [ -l[octal] ] [ -0[octal/hexadecimal] ]
        [ -Idir ] [ -m[-]module ] [ -M[-]'module...' ] [ -f ]      [ -C [number/list] ]      [ -S ]      [ -x[dir] ]      [ -i[extension] ]
        [ [-e|-E] 'command' ] [ -- ] [ programfile ] [ argument ]...

However, the man page does not explain what any of the options sTtuUWXhvcwpnafS do. Instead it refers you to perldoc. However, I can't seem to find any reference to the actual command line arguments in perldoc. Where are they actually documented? Is there some secret linux documentation information retrieval method I am unaware of here?

On a side note/rant, is the fact that I can't find this information an indication of a failing in the perl documentation? I am happy to read the documentation rather than just ask questions online, but I swear finding my answer in the documentation can be near impossible at times! Graarh! /rant

3

perlrun is the manpage you're looking for:

man perlrun
  • Egh. How was I supposed to know that?! – Cory Klein Jul 31 '12 at 20:52
  • 1
    man perl has references to specific versions of perl at the end (the 'see also' section, usually overlooked). Following them (e.g. man perl5.12) gives you all the manual pages you can think of. – Wojtek Rzepala Jul 31 '12 at 21:51
  • 1
    man perl primarily lists all of the other perl man pages, including perlrun Perl execution and options – cas Jul 31 '12 at 22:49
  • 1
    perlrun's online copy has hyperlinks and nicer formatting. Just to know that option too. – manatwork Aug 3 '12 at 17:52
  • Also note that not all distros install the complete perl manpages by default, so you might have to do, for example on Ubuntu, sudo apt install perl-doc. – David Röthlisberger Mar 17 '15 at 10:44
0

perl -h is useful

  • -e program: one line of program (several -e's allowed, omit programfile)
  • -p: assume loop like -n but print line also, like sed

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.