Re: Need explanation of code

2015-04-11 Thread Shlomi Fish
On Sat, 11 Apr 2015 21:20:22 -0700 SSC_perl 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 refe

Re: Need explanation of code

2015-04-11 Thread Andrew Solomon
Hi Frank I found the first one rather obscure, but they are equivalent. To prove this, Data::Dumper is my friend: #!/usr/bin/perl use strict; use warnings; use Data::Dumper; { my $self; print "selfish self \n"; %{$self->{'DATA'}} = ( foo => 'bar' ); print Dumper $self; } { my $self;

Re: Need explanation of code

2015-04-11 Thread shawn wilson
On Apr 12, 2015 12:23 AM, "SSC_perl" wrote: > > Could someone please explain the difference between: > > %{$self->{'DATA'}} = () } > The hashref of key "DATA" equals an empty list. The trailing bracket is the end of the else block. $self is also probably blessed (an object). ref($self->{

Need explanation of code

2015-04-11 Thread SSC_perl
Could someone please explain the difference between: %{$self->{'DATA'}} = () } and $self->{'DATA'} = {} 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: sub empty_db {

Re: Inhomogeneous data in a database

2015-04-11 Thread Andrew Solomon
Hi Alex Another option: replace `(navigation.target_type, navigation.target_id)` with `(navigation.html_target_id, navigation.fancyscript_target_id)` only one of which is defined for any given row, but both of which have foreign key constraints when they are defined. In answer to a subset of your

SV: Inhomogeneous data in a database

2015-04-11 Thread Tommi Helander
Hi Alex, Without going into details about your data model in general, then in your case I would probably create two different navigation tables: one for html and one for scripts. Then I would be able to create reliable foreign key constraints. Then, if I wanted a convenient way of selecting all