I am trying to write a big script but I am stuck on a part. I want to sprit an array based on ".."
From the script I got this:
print @coordinates;
gene complement(872..1288)
my desired output:
complement 872 1288
I tried:
1) my @answer = split(.., @coordinates)
print("@answer\n");
2) my @answer = split /../, @coordinates;
3) print +(split /\../)[-1],[-2],[-3] while <@coordinates>
4) foreach my $anwser ( @coordinates )
{$anwser =~ s/../"\t"/;
print $anwser;}
5) my @answer = split(/../, "complement(872..1288)"); #to see if the printed array is problematic.
which prints:
) ) ) ) ) ) ) ) )
6) my @answer = split /"gene "/, @coordinates; # I tried to "catch" the entire output's spaces and tabs
which prints
0000000000000000000000000000000001000000000100000000
But none of them works. Does anyone has any idea how to step over this issue?
Ps, unfortunately, I can't run my script right now on Linux so I used this website to run my script. I hope this is not the reason why I didn't get my desired output.
/\.\./. Otherwise, a dot matches "any character".