Just another Perl shrine | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Technically, this is more of a shell question than a perl question. That said, I can understand that it is highly relevant to perl programmers since we seem to take huge pride in our one-liners. ;-) For Bourne-shell and derivitives (such as ksh and bash), you simply need to put your program in single quotes, and not use single quotes inside your program. I think it's the same for C-shell, but I'm not really a C-shell expert. For CMD.EXE (both Win32 and OS/2), you need to use double quotes, and not use double quotes inside your program. Since double quotes interpolate everything, you may want to. Don't - use $/ instead of "\n", e.g., perl -e "print 'foo', $/". For other interpolation, use qq, e.g., perl -e "print qq(foo\n)". You also want to be careful with percent signs - avoid them if you can. If you can't, I think doubling them works - %% probably is replaced with a single %. I'm sure others will expand on this - but I've not had any need of more than this. I rarely use Windows, and when I have to, I don't need to do any modulos or print percent signs. In reply to Re: Escaping characters in one-liners
by Tanktalus
|
|