Thursday, March 1, 2007

[Perl Learning]: pay attention to s/.../.../ trap

perl command s/.../.../ will return how many thing has been replaced but not the result after replacement, it is very different from what sed does. $ echo a b c | perl -w -nle 'print s/a/aa/' will return 1 do it this way: $ echo a b c | perl -w -nle 's/a/aa and print' aa b c

No comments: