in reply to Re(2): (Ovid): uninitialized value in concatenation
in thread uninitialized value in concatenation

In this
my $name = undef; # store subparent for each parent my %parent_hash = ( 'Father' => 'Mother', 'Mother' => 'Father' ); if (exists $parent_hash{$parent}) { my $sub_parent = $parent_hash{$parent}; for my $col ( $parent, $sub_parent ) { my $sql = "select $col from Roster where User=?"; my $rv = $dbh->selectcol_arrayref( $sql, undef, $user ); if ( @$rv ) { # any rows returned? $name = $rv->[0]; # take first one last; } } } # here, $name will be defined if one of above succeeded
what is the undef do inside the
my $rv = $dbh->selectcol_arrayref( $sql, undef, $user );

Replies are listed 'Best First'.
Re(4): (Ovid): uninitialized value in concatenation
by dmmiller2k (Chaplain) on Jan 15, 2002 at 20:00 UTC

    From the DBI docs:

    selectrow_array @row_ary = $dbh->selectrow_array($statement); @row_ary = $dbh->selectrow_array($statement, \%attr); @row_ary = $dbh->selectrow_array($statement, \%attr, @bind_values);

    where the third form is the one I was using, without specifying any attributes (i.e., undef).

    dmm

    If you GIVE a man a fish you feed him for a day
    But,
    TEACH him to fish and you feed him for a lifetime
Re(4): (Ovid): uninitialized value in concatenation
by dmmiller2k (Chaplain) on Jan 15, 2002 at 20:01 UTC

    From the DBI docs:

    selectrow_array @row_ary = $dbh->selectrow_array($statement); @row_ary = $dbh->selectrow_array($statement, \%attr); @row_ary = $dbh->selectrow_array($statement, \%attr, @bind_values);

    where the third form is the one I was using, without specifying any attributes (i.e., undef).

    dmm