Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Readonly variable

by japhy (Canon)
on Feb 26, 2001 at 22:33 UTC ( #60923=note: print w/replies, xml ) Need Help??


in reply to Readonly variable

You could find out with the Devel::Peek module, but that's probably too much effort.
sub is_readonly { eval { substr($_[0],0,0) = '', 1 } }


japhy -- Perl and Regex Hacker

Replies are listed 'Best First'.
Re: Re: Readonly variable
by Gloom (Monk) on Feb 26, 2001 at 22:52 UTC
    do you mean sub is_readonly { eval { substr($_[0],0,0) = '' ; 1 } } ?

    This way is very smart. I will use it, thx :)

      You can use a comma or a semicolon, there is no difference. An even shorter (faster?) approach might be: sub is_readonly { eval { $_[0] = $_[0], 1 } }

      japhy -- Perl and Regex Hacker

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://60923]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (1)
As of 2022-05-19 03:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (71 votes). Check out past polls.

    Notices?