Sep 21, 2009, 6:28 AM
Post #2 of 2
Re: [sysprogerz] I found bug in perl, do you know the workaround?
[In reply to]
I am making this batch file :
perl -pi -e 's/$find/zzz/g' as.txt
and this file:
When i run the as.sh, it gives :
It is supposed to replace aaa with zzz, anyone knows why?
Oh, you want to know why too?
perl -pi -e "s/$find/zzz/g" as.txt
Using single quotes means $find is not expanded so perl sees: perl -pi -e 's//zzz/g' which means subsitute at the first opportunity, which is the beginning of the line.
I love Perl; it's the only language where you can bless your thingy.
Perl documentation is available at perldoc.perl.org. The list of standard modules and pragmatics is available in perlmodlib.
Get Markup Help. Please note the markup tag of "code".