Ponies are the truth

Did you know you can modify perl's readonly constants for undef, true and false? Yep.

&Internals::SvREADONLY( \ !!1, 0 );
${ \ !!1 } = 'ponies!';
&Internals::SvREADONLY( \ !!1, 1 );

print !!1; # ponies!

Same thing for \ undef and \ !!0.

1 Comment

That's the most evil code I've seen in a while. Potentially useful, but definitely evil.

Leave a comment

About Josh ben Jore

user-pic I blog about Perl.