Kenneth Lee wrote:
>
> > Once a hash has been C-ized, the only way to extend its set of
> > entries is via another call to C:
> >
> > sub new {
> > my ($class, %self) = @_;
> > bless private \%self, $class;
> &g
> Once a hash has been C-ized, the only way to extend its set of
> entries is via another call to C:
>
> sub new {
> my ($class, %self) = @_;
> bless private \%self, $class;
> private $self{seed} = rand; # okay
> $self{se
> package Derived;
> use base 'Base';
>
> sub new {
> my ($class, $derdatum, @basedata) = @_;
> my $self = $class->SUPER::new(@basedata);
> private $self->{data} = $derdata;
dear all,
it seems all the "lvalue sub" RFCs haven't mentioned this.
currently we can do
$str = "foo bar";
substr($str, 4, 0) = "baz ";
and $str will become "foo baz bar". should we be able to do
this with lvalue-subs? how can one returns "pointer" to a
portion of a scalar?
kenneth
dear all,
today this just came up to my mind, we could have a pragma that disable
`autovivification' of hash and array keys. Consider the follow code snippet:
@arr = ( 0..9 );
%hash = ( a=>1, b=>2 );
{
no autovivify;
$arr{10}++; # both are
$hash{c}--; # fatal
}
this way