Help for this page

Select Code to Download


  1. or download this
    # @ins is actually calculated at runtime. 
    # Defined here for demonstration.
    ...
    my $in = join ', ', @ins;
    my $sth = $dbh->prepare("SELECT foo FROM Bar WHERE baz IN ( ? )");
    $sth->execute( $in );
    
  2. or download this
    my @ins = qw(1 2 3 4 5 6);
    my $in;  $in .= '?, ' for @ins;
    ...
    $in =~ s/, $//;
    my $sth = $dbh->prepare("SELECT foo FROM Bar WHERE baz in ( $in )");
    $sth->execute( @ins );