On Sat, 11 Apr 2015 21:20:22 -0700 SSC_perl <p...@surfshopcart.com> wrote:
> Could someone please explain the difference between: > > %{$self->{'DATA'}} = () } > > and > > $self->{'DATA'} = {} The first line works on the physical reference $self->{'DATA'} and empties it. The second one assigns a new empty reference to it, but if something extracted $self->{'DATA'} and kept a copy to it, it won't be affected. Normally, they both will have the same affect. Regards, > > I was told that they are equivalent, but they're not. One works and > the other doesn't, so they must be different. Here's the context: > How does it not "work"? What are the symptoms? > -------------------- > > sub empty_db { > my $self = shift; > if ($self->{'USEDBM'} eq 'sql') { > $self->{'SQL'}->do("DELETE from $self->{'DB'}") or > $self->{'ERRMSG'} .= $DBI::errstr and return; } > else { %{$self->{'DATA'}} = () } > # else { $self->{'DATA'} = {} } # This does nothing > } > That may not be enough context. Regards, Shlomi Fish -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ My Photos - http://www.flickr.com/photos/shlomif/ The only things worse than XSLT are Excel and Sugar‐Less Tea (XSLT). — http://www.shlomifish.org/humour/bits/facts/XSLT/ Please reply to list if it's a mailing list post - http://shlom.in/reply . -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/