Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

this program "how do i permute N elements of a list" is ok but large data output(eg 490 permutations of say an input of a a b b b c d) displays up the screen too fast to read and I need to print the output to the printer. The copy function on the msdos bar is inoperable, so i don't know how to get the permutation results off of the msdos screen and into a usable media. can anyone help? I've just become a user of perl just to use this program, very little talent for perl is at my disposal so all help needs to be complete and simple, please. responses can be made to swanhits@hotmail.com hurry please!

Replies are listed 'Best First'.
Re: permute n elements
by Adam (Vicar) on Oct 21, 2000 at 04:52 UTC
    You can re-direct the output of a program in dos using the > character:
    c:\>perl script.pl > out.txt
    But you can also highlite the text in the dos-box and right click to get it onto the Microsoft clipboard. (It doesn't say anything, but trust me the text has been copied)

    The best solution, however, is to write your script to print to a file directly. Read open and print and close and remember to check your open call for success.

RE (tilly) 1: permute n elements
by tilly (Archbishop) on Oct 21, 2000 at 05:18 UTC
    Are you on Windows or NT? If you are on NT then you are in luck. Just right-click at the bar across the top of the DOS window, select edit, then mark. Mark with your mouse and hit return. Alternately hold alt, hit space, and then hot-key through the same motions. (You can do the same to paste.)

    One either you can redirect the output to a file (either by opening a filehandle or with > at the command prompt) and then open in notepad. If you want you can even launch notepad from Perl with a system command.

    And another neat trick, there is a module called Win32::Clipboard that you can use. Have Perl collect all of the output in a single string, and then paste that to the clipboard, from which you can paste anywhere you want.

    I may not be the biggest fan of Windows in the world, but I have learned a few tricks and there is no need to be any more miserable while using it than necessary... :-)