in reply to List vs array printing in perl
Use:
perl -e 'print +(getpwnam(traveler))[2,3];'
To understand why your attempt doesn't work add -w:
C:\test> perl -we "print (getpwnam(traveler))[2,3];" print (...) interpreted as function at -e line 1. Unquoted string "traveler" may clash with future reserved word at -e l +ine 1. syntax error at -e line 1, near ")[" Execution of -e aborted due to compilation errors.
|
|---|