Returns:#!/usr/bin/perl -w use strict; my $str = 'NNNNNATCGNNNNATCG'; my @substr = qw(ATCG ATCG); foreach (@substr) { my $id = index($str,$_); print "$id\n"; }
How can I overcome this problem such that the index function can recognize the second substrings in the correct position? Returning this instead:5 5
5 13
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |