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 } }
[download]
japhy
--
Perl and Regex Hacker
Comment on
Re: Readonly variable
Download
Code
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 :)
[reply]
[d/l]
Re: Re: Re: Readonly variable
by
japhy
(Canon)
on Feb 26, 2001 at 22:56 UTC
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
[reply]
[d/l]
In Section
Seekers of Perl Wisdom