$chromosome =~ /^chrM/ may do what you need if you want $chromosome to start with chrM (that's what ^ means, it's the start of the string). Note that if you want to check if it is equal to "chrM" this is done with the eq operator, so $chromosome eq "chrM" (see Relational Operators and Equality Operators)
Also FYI if you want to check that a string is contained in another, you can use index which is easier to use and less tricky than regular expressions.
In reply to Re: Trouble skipping lines using Perl
by Eily
in thread Trouble skipping lines using Perl
by LeBran
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |