Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re^4: splitting arrays

by Anonymous Monk
on Apr 15, 2005 at 13:34 UTC ( #448154=note: print w/replies, xml ) Need Help??

in reply to Re^3: splitting arrays
in thread splitting arrays

sadly, there is no "line" termination character, i only know when to start the next one after 50 tab-delimited 'things' have been found

Replies are listed 'Best First'.
Re^5: splitting arrays
by RazorbladeBidet (Friar) on Apr 15, 2005 at 14:03 UTC
    if newlines are considered part of the data:
    { local $/="\t"; my $i = 0; my @arr = (); while ( <FILE> ) { push @{$arr[$i++%50]}, $_; } }
    This should (note that the code is untested) give you an array of array references that each contain 50 items (except possibly the last array ref).

    Does that do what you wanted?
    "But what of all those sweet words you spoke in private?"
    "Oh that's just what we call pillow talk, baby, that's all."

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (7)
As of 2021-09-22 08:10 GMT
Find Nodes?
    Voting Booth?

    No recent polls found