|Just another Perl shrine|
strange usage of s/// [solved: Perl 5.14 and 5.16 bug]by brx (Pilgrim)
|on Sep 03, 2013 at 14:52 UTC||Need Help??|
brx has asked for the
wisdom of the Perl Monks concerning the following question:
*update* : bad link corrected
*update3* : problem solved, it's a Perl 5.14 and 5.16 bug.
Thanks, contributors, especially slms. As explained in slms's post(Re^2: strange usage of s///), Perl 5.18 behavior is correct :
Perl v5.18.1 handles them as one would expect:
With Perl 5.14 and 5.16, there is a bug and some quantum tunnelling in s/// (yep! ;):
Could you, please, help me to understand one mysterious golf solution posted by "tails" at http://golf.shinh.org/p.rb?Bisection . (problem: read line, eg "abcdef", and print bisection, ie "abc def")
This is not the best answer (shortest) but it seems very strange... Here is the code (
*update* : why $" is different from literal space character in this regex? how this regex can add something to $_?
My other strange tests
FYI, "tails" also wins the contest with:
Nice usage of (?0), tails! :)
English is not my mother tongue.
Les tongues de ma mère sont "made in France".