Hi guys,
As the title says, what I wanted to do is take one DNA file and put it into an array, do the same to a second DNA file and then insert one of the files somewhere in the other.
I have 2 files, DNA3 and DNA4
The content within the DNA3 file is: ATCGC
The content within the DNA4 file is: AAATTGC
What I want to do is to insert DNA4 into position #1 in DNA3, so the result would look like this: AAAATTGCTCGC
Currently my code looks like this:
#!/usr/bin/perl -w $DNA3file = 'testDNA3'; open(DNA3handle, $DNA3file); @DNA3 = <DNA3handle>; $DNA4file = 'testDNA4'; open(DNA4handle, $DNA4file); @DNA4 = <DNA4handle>; splice (@DNA3, 1, 0, @DNA4); print @DNA3, "\n"; exit;
However, what is displayed really puzzled me:
ATCGC
AAATTGC
*Note, in my complier there isn't the space in between the output*
For the life of me I can't figure out what is wrong, I can run the above operation fine if I manually insert the DNA sequences into an array, but for large DNA set that is simply not possible. Really appreciate any help here, thanks for your time!
In reply to Splice an array into another array by Smeb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |