Q&A

Q1: My one-liners don't work in MacPerl.
A1: Make sure in the Edit, Peferences, Scripts dialog that you have “Run Scripts Opened from Finder” selected. If you've chosen “Edit” here your one-liners won't work (“One Liner” is itself a MacPerl script).
Q2:My one-liners don't work in Windows.
A2: Notions of quotes are different in the Windows/DOS command line than they are on Unix. You can use both single and double-quotes in Unix; in Windows you can only use double quotes. For one-liners in Windows, make sure that you surround the entire one-line script in double-quotes and that all quotes inside the actual script are back-slashed.
Q3:My one-liners don't work in Unix.
A3: They don't? Did you type the script all on one line with no returns? Did ...

Get Sams Teach Yourself Perl in 21 Days, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.