http://www.perlmonks.org?node_id=1039006


in reply to index using a range

Using index with tr/// :

    perl -E 'say index("000001000"=~tr/0/1/cr, "1")' # says "5"