opendir(DIR, $some_dir) || die "can't opendir $some_dir: $!"; @dots = grep { /^\./ && -f "$some_dir/$_" } readdir(DIR); closedir DIR; #### my @array = qw(One Two Five Nine); my %check_hash = map {$_ => 1} @array; #### @fields = qw(Name ID Age); #assuming $dbh and $q exist, and primary key in $key my $statement = 'update my_table '.join(",", map {"set $_ = ?"} @fields)." where Key=?"; my $sth = $dbh->prepare($statement); $sth->execute(map({$q->param($_)} @fields), $key); #### @fields = qw(Name ID Age Key); #assuming $dbh and $q exist, and primary key name in $key #we don't want to change the value of the key! my $statement = 'update my_table '.join(",", map {"set $_ = ?"} grep(!/^$key$/, @fields))." where $key=?"; my $sth = $dbh->prepare($statement); $sth->execute(map({$q->param($_)} @fields)); #### $sth->execute(map({$q->param($_} grep(!/^$key$/, @fields)), $q->param($key));