Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Splicing the next element in an array

by zwon (Abbot)
on Apr 08, 2014 at 16:04 UTC ( #1081523=note: print w/replies, xml ) Need Help??


in reply to Splicing the next element in an array

Your @finalArray contains just one element. Also, '\n' and "\n" are not the same.
use 5.010; use strict; use warnings; my @infoArray = ( 1, 2, 3, 4, 5, "\n", 6, 7, 8, 9, 10, "\n" ); my @line; for (@infoArray) { if ( $_ eq "\n" ) { say join "\t", @line; @line = (); } else { push @line, $_; } }

Replies are listed 'Best First'.
Re^2: Splicing the next element in an array
by Anonymous Monk on Apr 08, 2014 at 17:07 UTC
    This made much more sense, and worked on my input file. Thank you.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2020-06-02 16:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you really want to know if there is extraterrestrial life?



    Results (19 votes). Check out past polls.

    Notices?