my @array = qw(a b c); my @tmp = ('?') x @array; # @tmp now contains ('?', '?', '?') my $p_str = join ",", @tmp; # $p_str now contains '?,?,?'