added the indexing Perl code