ravi45722 has asked for the wisdom of the Perl Monks concerning the following question:

my $placeholders = join(',',('?') * 8);

I need an output of ?,?,?,?,?,?,?,? But its returning zero. I dont know where i mistaken. Plz correct it

Replies are listed 'Best First'.
Re: How to use * operator in JOIN
by Laurent_R (Canon) on Jul 31, 2015 at 09:11 UTC
    I guess that you mean:
    $placeholders = join(',',('?') x 8);
Re: How to use * operator in JOIN
by johngg (Canon) on Jul 31, 2015 at 09:12 UTC

    Use x, not *!

    $ perl -E 'say join q{,}, ( q{?} ) x 8' ?,?,?,?,?,?,?,? $

    Cheers,

    JohnGG

Re: How to use * operator in JOIN
by kennethk (Abbot) on Jul 31, 2015 at 14:39 UTC
    What Laurent_R and johngg said. For documentation of the repetition operator, see Multiplicative Operators.

    #11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.