[OT, but while the discussion is here...]

On Fri, 15 Mar 2002 16:37:18 -0800, Rob Bloodgood wrote (and quoted):

>> JB1: perl -e "print('?',',?'x (split(',',$ARGV[0])-1));" "a,b,c,d,e,f"
>> ?,?,?,?,?,?
>>
>> P.S. I get this on the latter...
>>      Use of implicit split to @_ is deprecated at -e line 1.

>what if you removed the () around split()?  It seems extraneous ... and now
>that I look at it, you *should* remove the parens and change it to scalar:
>
>perl -e "print join(',', ('?') x scalar split(',',$ARGV[0]);"

Actually it is the scalar context for split() that causes the split into
the default @_ and the accompaning warning.

I'd simply count comma's, with tr/,//.

And this:

>>      print '?',',?'x (...);

looks like a perfect candidate for join().

        local $_ = shift;
        print join ',', ('?') x (tr/,//+1);

-- 
        Bart.

Reply via email to