|Perl Monk, Perl Meditation|
Re: One Linersby blazar (Canon)
|on Jan 11, 2005 at 11:07 UTC||Need Help??|
I'm new here and finally have a question that I couldn't find and answer to (a first). Can anyone point me to some resources/documentation/tutorials etc on perl one-liners?Well, a few other monks already gave you some answers addressing exactly your question. As an example of a one-liner I routinely use I'll give:
under Windows to convert from *NIX-style \n's to Redmondish ones (yes, I know there are tons other WTDI both in Perl and with other tools - but this way I don't even have to remember which is which).
The -i.bak is there because under Windows (at least 98 or earlier, that is, and if things have not changed recently) you can't have -i without backups...
I have picked up some things here and there, but would like better explanations on what the options like -pie, pack and alike do and what they are for.The answer to all of these question is out there, in the docs: please check
perldoc pelrun perldoc -f pack perldoc perlpacktut
Please note that in certain environments the kind of answer such a question would get could be at best an educated RTFM.
However I would like to point out that while indeed -pie has to do with one-liners, pack() is yet another Perl function, so you can use it in a one-liner, granted; but I don't see how it can be strictly related to your question (however I hope the tutorial above will help you).
In any case -pie is just the same as -p -i -e: -p adds a loop around your program, that is given on the cmd line itself by means of -e and finally -i does inline editing. You can check by yourself what -p adds to your code: