boo_radley has asked for the wisdom of the Perl Monks concerning the following question:
My concern is over the keys and values. I know it's unreliable to expect a hash's contents to come out in a consistent order after manipulating it; I want to know if keys and values will ever present the same problem. That is to say, given the followingsub update_table{ my $l_tablename = shift; my %l_fields = shift; my $l_fieldnames; my $l_fieldvalues; my $l_prepare; my $l_fieldnames = join ",", keys %l_fields; my $l_fieldvalues = join ",", values %l_fields; $l_prepare = "INSERT $l_tablename (" . $l_fieldnames . ")\n VALUES + (" . $l_fieldvalues . ")"; }
if keys %x yields (b,d,c,a), I expect values %x to yield (2,4,3,1). Some testing confirms this, but I'd like to know if there are any special exceptions, or if I've just been lucky in my experiences.%x = (a =>1, b =>2, c =>3, d =>4);
|
|---|