in reply to Re^2: Trouble skipping lines using Perl
in thread Trouble skipping lines using Perl

I went with

next if ($chromosome =~ "chrM");

That works, but personally I wouldn't write it that way, because writing a regex like for example /chrM/ or m{chrM} makes it more visually clear what you want to do (and also allows you to add modifiers).

I was using both Strict and Warnings and using the quotes instead of the regex doesn't produce any warnings

Are you sure? next if ($chromosome = "chrM"); should have given you the warning "Found = in conditional, should be ==". Perhaps you're not enabling warnings correctly?

Update:

My apologies about the input data format

You can edit your posts (please mark updates as such), see How do I change/delete my post?

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

    Sorry,

    I meant no warnings were produced at the end result, I got the warning you mentioned initially before using the ~

    Cheers