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

Re^2: searching for multiple lines from outfile and printing them all in the final outfile

by Anonymous Monk
on May 18, 2009 at 19:29 UTC ( [id://764708]=note: print w/replies, xml ) Need Help??


in reply to Re: searching for multiple lines from outfile and printing them all in the final outfile
in thread searching for multiple lines from outfile and printing them all in the final outfile

it is sub-select lines from "output file" to a "final output file." and random selction from output file.

am I clear or please let me know if you need mroe information.

Thanks a lot.
  • Comment on Re^2: searching for multiple lines from outfile and printing them all in the final outfile

Replies are listed 'Best First'.
Re^3: searching for multiple lines from outfile and printing them all in the final outfile
by ww (Archbishop) on May 19, 2009 at 12:44 UTC

    Assumes @output is populated from your source; prints to console:

    for (0..9) { print $output[rand($#output)] . "\n"; }
    • Printing to your final_output.txt file is left as an exercise for the student (since you've already solved that).
    • This is likely to select duplicate_lines to your final file, which is still permitted by your spec (but which -- I think -- is not actually your intent). Search the Monastery for unique or @seen and similar for the many solutions to avoiding duplication.
    • There is not need to create an output file (thereby eating cycles and disk space); do your initial selection from the source to an array @output.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2024-04-25 12:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found