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