Question:
When you extract a value from an @ are you guarenteed the order that 
you are going to get?

Example:
foreach $value (@some_array) {
        #do something to $some_array[0]
        #on the next pass through the foreach and the @some_array
        #do something to $some_array[1]
        #on the next pass through the foreach and the @some_array
        #do something to $some_array[2]
        #and on and on
}

I know that in a hash it's anyone's guess what order yo will get the
keys unless you use something like Tie::IxHash. The question is the
ordering of an array.

The problem:
before I do my join below I have two other array's one with,
names and one with values (@other_names, @other_values)that I want 
to push into the @value_array and @name_array. The issue is not how do I do
that
but when I extract the values from each of the @other_names or
@other_values
arrays I want to make sure that $other_name[0] and $other_value[0] get
push[ed]
into their new respective arrays so that all the elements match up.
Otherwise
you can see below that either I will throw an exception or I will get
corrupted
data.

my $value_list = "(" . join(",", @value_array) . ")";
my $name_list = "(" . join(",", @name_array) . ")";

my $dbh = DBI->connect("DBI::CSV:f_dir=/blah/blah")
                       or die "Cannot connect: " . $DBI::errstr;

my $sql = qq`INSERT INTO $table $name_list VALUES $value_list`;
my $sth = $dbh->prepare($sql)
                        or die "Cannot prepare: " . $dbh->errstr();

$sth->execute() or die "Cannot execute: ". $sth->errstr();
$sth->finish();


Thoughts?

jeffl


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to