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

Re^2: randomize a text file

by perlnoobster (Sexton)
on Jul 17, 2013 at 13:55 UTC ( #1044815=note: print w/replies, xml ) Need Help??


in reply to Re: randomize a text file
in thread randomize a text file

Hi BrowserUk, I want to randomize the rows, i.e. the columns stay the same, can you help me? thank you

Replies are listed 'Best First'.
Re^3: randomize a text file
by BrowserUk (Pope) on Jul 17, 2013 at 15:44 UTC
    , can you help me?

    Depends. Post code that reads the file into an array, then maybe.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
Re^3: randomize a text file
by hdb (Prior) on Jul 18, 2013 at 09:04 UTC

    If you want to randomize rows only, read your file into an array of rows, apply shuffle from List::Util and print shuffled array into new file. That's all, probably just a one-liner, don't even need to chomp.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1044815]
help
Chatterbox?
[GotToBTru]: you could, yes
[GotToBTru]: whether or not it would be the best tool for that job .. that is another question

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (9)
As of 2017-02-22 18:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?






    Results (335 votes). Check out past polls.