Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
No such thing as a small change
 
PerlMonks  

Re^3: splitting arrays

by RazorbladeBidet (Friar)
on Apr 15, 2005 at 09:27 UTC ( [id://448152]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


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

So are you saying that inside that line of 50 items (I'm assuming you're using the term "bits" to mean "things" not 0 or 1) there are newline characters? If so, what is the line termination character - how do you know when you need to start on the next "line".
--------------
"But what of all those sweet words you spoke in private?"
"Oh that's just what we call pillow talk, baby, that's all."

Replies are listed 'Best First'.
Re^4: splitting arrays
by Anonymous Monk on Apr 15, 2005 at 09:34 UTC
    sadly, there is no "line" termination character, i only know when to start the next one after 50 tab-delimited 'things' have been found
      if newlines are considered part of the data:
      (untested)
      { 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?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://448152]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.