Perl - Internal File (create and execute)
Posted
by drewrockshard
on Stack Overflow
See other posts from Stack Overflow
or by drewrockshard
Published on 2010-04-03T21:35:20Z
Indexed on
2010/04/03
21:43 UTC
Read the original article
Hit count: 451
I have a quick question about creating files with perl and executing them. I wanted to know if it was possible to generate a file using perl (I actually need a .bat script) and then execute this file internally to the program. I know I can create files, and I have with perl, however, I'm wanting to do this internally to the program. So, what I want it to do is actually create a batch script internally to the program (no file is actually written to the disk, everything remains in memory, or the perl program), and then once it completes the writing of the file, I'd like to be able to actually execute this file, and then discard the file it just wrote. I'm basically trying to have it create a batch script on the fly, so that I can just have output text files from the output of the script, rather than creating the batch script on disk, then executing it, and then deleting the batch file from disk when its done.
Can this be done and how would I go about doing this?
Regards, Drew
© Stack Overflow or respective owner