- or download this
opendir(DIR, $some_dir) || die "can't opendir $some_dir: $!";
@dots = grep { /^\./ && -f "$some_dir/$_" } readdir(DIR);
closedir DIR;
- or download this
my @array = qw(One Two Five Nine);
my %check_hash = map {$_ => 1} @array;
- or download this
@fields = qw(Name ID Age);
#assuming $dbh and $q exist, and primary key in $key
my $statement = 'update my_table '.join(",", map {"set $_ = ?"} @fie
+lds)." where Key=?";
my $sth = $dbh->prepare($statement);
$sth->execute(map({$q->param($_)} @fields), $key);
- or download this
@fields = qw(Name ID Age Key);
#assuming $dbh and $q exist, and primary key name in $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));
- or download this
$sth->execute(map({$q->param($_} grep(!/^$key$/, @fields)), $q->param(
+$key));