Feb 25, 2016, 8:20 PM
Post #3 of 4
This is the third time you have asked almost the same question. You have received several good answers. Most of them involve replacing print with push or other functions. You have not explained why this does not meet your requirements. Perhaps, you really want to capture the output of the print.
Re: [regex2012] how to save output (not file handles or to screen)
[In reply to]
The output of print is a stream of characters. This stream can be directed to a file, an external device, another program, or a string using options in the open statement. It is not possible to direct it to an array. Perhaps you are thinking of the C language where a 'string' is an array of characters. Refer to the section of Related to 'In-memory' files for information on opening a filehandle which will "print' to a perl string.