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 :)