in reply to gene location

Given the apparent problem domain you might look at BioPerl rather than reinventing wheels.

That being said it jumps out that your regex /\d+..\d+/ won't match the text "<5504..>6553" because you're not allowing for the less/greater before the numbers.

Also: You might want to clean up your formatting because it's entirely unclear from the indentation and nesting where your loops and if statements are beginning and ending (c.f. Perl::Tidy)

The cake is a lie.
The cake is a lie.
The cake is a lie.

Replies are listed 'Best First'.
Re^2: gene location
by Eily (Monsignor) on Jun 12, 2019 at 13:50 UTC

    Actually since the dots are not escaped in the regex, they can match any character, including numbers. So /\d+..\d+/ will match 5504, 02g0, and 9832. Each line will match.

Re^2: gene location
by nica (Novice) on Jun 12, 2019 at 13:49 UTC
    yes, you are right, I forgot to write them here, in my program they are, but anyway all that I can find in my output file is a lot of commas

      Ah, derp. I blame the bad formatting for missing that. Yeah, that's it.

      At any rate that's because your regex isn't capturing anything so $1 and $2 don't have anything in them. Again, known format don't reinvent wheels you don't have to; but for something quick and dirty . . .

      if( my( $start, $stop ) = $line =~ m{ < (\d+) \.\. > (\d+) }x ) { $n++; print OUT qq{$start, $stop, $header\n}; }

      The cake is a lie.
      The cake is a lie.
      The cake is a lie.

        Thank you :) it worked