in reply to Trouble skipping lines using Perl

$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.

Replies are listed 'Best First'.
Re^2: Trouble skipping lines using Perl
by LeBran (Initiate) on Nov 21, 2017 at 17:05 UTC

    Hi,

    Yeah that  eq operator actually seems really useful, and presumably would deal with certain warnings in relation to using a =

    Cheers