in reply to Re: Hash slice to get DB values - include undefined values?
in thread Hash slice to get DB values - include undefined values?

Duh - how right you are... I thought that my problem was happening because my @vals array was too short... but, armed with the certainty that it couldn't be that, I revisit the code and find that it's another problem.

The moral of this story is, if you want to know what's in an array in your CGI, don't do
print @array;
do
print $_,br for @array;
Thanks!

§ George Sherston

Replies are listed 'Best First'.
Re: Re: Re: Hash slice to get DB values - include undefined values?
by demerphq (Chancellor) on Dec 11, 2001 at 20:00 UTC
    Or perhaps
    print join("<BR>",@array)."<BR>";
    BTW, im sure you know this already but you could convert all of the undefs to a given constant quite easily
    my @values=map { exists $hash{$_} ? $hash{$_} : $constant } @keys_need +ed;
    You might want to change the exists() to a defined() if you dont want _any_ undefs getting through.

    :-)

    Yves / DeMerphq
    --
    This space for rent.