|
Certainly! That expands to: perl -l -p -0 -e 1 /proc/$pid/environ
-l [octnum] is "automatic line-ending processing": it means the "input record separator" ($/, which defaults to "\n") is automatically stripped from the end of lines as they're read in; and the "output record separator" ($\, defaults to nothing), which is automatically appended to anything you print(), is set - to the character with the given octal code if specified, otherwise to the current value of $/.-p makes perl act like sed: the input (which can either be stdin or the files listed after the flags on the command-line) is read one-line-at-a-time into $_, and for each line, your program is run, then $_ is printed. -0 [octnum] sets the input record separator - and with no following digits, it gets set to the null character, "\0". -e [script] specifies the content of the script to run - in this case, "1", a very terse way of doing nothing. So: read each null-terminated "line", strip off the trailing null character, do nothing, then print it with a trailing newline. The sneaky part is the ordering of the flags: -l does { $\ = $/ }, -0 does { $/ = "\0" }, and they're processed in order - so if -0 appeared before -l, it wouldn't work, you'd wind up with both record separators set to "\0"; "-l0" would mean "-l with 0 as its parameter", ie { $\ = "\0" }, so I need to stick something else (-p) in between them if I want to squash everything into one argument without changing the meaning; and -e1 has to appear at the end, because -e eats the rest of the argument. |