Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^4: Splice an array into another array

by Smeb (Novice)
on Jun 23, 2017 at 23:33 UTC ( [id://1193421]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Splice an array into another array
in thread Splice an array into another array

Could you explain this code a bit?  @DNA3=split('',join('',@DNA3)); I don't quite get what it means and why this is necessary for my script to work.

Replies are listed 'Best First'.
Re^5: Splice an array into another array
by AnomalousMonk (Archbishop) on Jun 23, 2017 at 23:49 UTC

    @DNA3 = <DNA3handle>; # read all LINES of file into array chomp @DNA3; # remove any and all newlines @DNA3=split('',join('',@DNA3)); # join('',@DNA3) join all LINES into + one long line # split('', ...) split long line int +o list # of individual chara +cters # @DNA3= ... assign list of indi +vidual # characters to an ar +ray
    @DNA3 will end up looking something like  ('A', 'T', 'C', 'G', ...) See chomp, join, split.

    Update: Fixed up formatting of long comment lines for last statement.


    Give a man a fish:  <%-{-{-{-<

      thank you :)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1193421]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-04-24 19:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found