Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Perl allows you to change the definition of false to make it true. (And vice versa.)

by Anonymous Monk
on Dec 14, 2012 at 14:26 UTC ( #1008843=note: print w/replies, xml ) Need Help??


in reply to Perl allows you to change the definition of false to make it true. (And vice versa.)

This should please the comp.lang.c old timers:
use strict; use warnings; use 5.010; BEGIN { &Internals::SvREADONLY(\undef, 0); ${\undef} = "Demons are coming out of my nose!"; };
I wonder if you can redefine other read-only values? I could not get the following to work.
BEGIN { &Internals::SvREADONLY(\'blue', 0); ${\'blue'} = 'turtle'; &Internals::SvREADONLY(\5, 0); ${\5} = 5.000000000001; };
(I have no idea why you would want to do this apart from JAPH or intentional sabotage)
  • Comment on Re: Perl allows you to change the definition of false to make it true. (And vice versa.)
  • Select or Download Code

Replies are listed 'Best First'.
Re^2: Perl allows you to change the definition of false to make it true. (And vice versa.)
by tobyink (Abbot) on Dec 14, 2012 at 15:14 UTC

    AFAIK, only true, false and undef. I thought perhaps "0 but true" might work (as that has special handling - it doesn't warn if used in numeric context) but no joy.

    perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1008843]
help
Chatterbox?
[atcroft]: Lady_Aleena: I found the L<name|section> syntax, which describes linking to a perl manual page, and L<text|url> to link to a web page. The reason I asked was because I was on search.cpan.org looking at a module,
[atcroft]: and it referred to several other modules, but the links went to metacpan.org. I found that a bit of a surprise, and it got me wondering if there was a "standard" way to link to other modules in the documentation on CPAN.
[Lady_Aleena]: atcroft. maybe look at raw PODs. There is also L<foo|http://foo. com> and some might be linking directly to meta::cpan.
[Lady_Aleena]: Oops, didn't read the L<text|url> right.

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2017-05-27 03:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?