Quote:
Originally Posted by zazzybob
EDIT> cbkihong looks like we were typing our replies at the same
Yep. But I was lucky to hit the "submit" button sooner.
Quote:
why does this alone does not run while grep and other nix commands run on the shell script?
The simple answer:
Perl and awk/sed are different things.
The Perl command-line arguments offer some switches to make shell scripters happy. Because many shell scripters particularly on Unix expect to write a simple single-liner for various sysadmin-related file processing (as with awk/sed) instead of "typical" programming, the -p and -i arguments makes it convenient to do in-place file editing with Perl as you expect, say, in sed. But we all know this is not real in-place editing, so the rename-read-write strategy is actually used. These options make it possible for you to emulate the command-line behaviour of sed/awk. With the -e argument, it can be used by, say, Makefiles to construct the replacement pattern on-the-fly without preparing the script file in advance.
Perl is a more general programming language than awk/sed. Think of it as something like Java, C++ or PHP. They are not like awk/sed which are specific for file processing, so in-place edit are not made the default. And you need to spell it out explicitly if you are to do it in any programming languages, including Perl.