Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Splicing the next element in an array

by zwon (Abbot)
on Apr 08, 2014 at 16:04 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1081523]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (3)
As of 2024-04-20 01:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found