On Mon, Apr 16, 2001 at 05:47:55PM +0200, M.W. Koskamp wrote:
> > However, if $sth->fetchrow_array() really returned the session value, not
> > the user value, that is a bug, because in a scalar context fetchrow_array()
> > should return the value of the first selected field, not the last.  I don't
> > see this bug in the latest version of DBI, though.
> 
> You have point there, tho you might also expect that in 'real' scalar
> context $user would contain the value 2, which is the length of the list.

Not if fetchrow_array() used wantarray() properly to determine what context
it was called in.  Which it does.  :)


> But in general it is not a good idea to use || or 'OR' in a list or hash
> assignment.

I think that or can be very useful with a list assignment, because a list
assignment returns the number of items assigned.  Thus:

#!perl

print "okay: ";
@list = okay() or print "Nothing assigned with okay.";
print "@list\n";

print "not okay: ";
@list = notokay() or print "Nothing assigned with notokay.";
print "@list\n";

sub okay { return ('a', 'b'); }
sub notokay { return; }

__END__

Ronald

Reply via email to