Automating a perl script by another perl script
Hi, I have a perl script which prompts user for certain inputs. I want to automate this by creating a separate script which runs the above perl file and probably passing the inputs in a separate text file. Can anybody give me some pointers or how to do this ? Thanks Alok. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Automating a perl script by another perl script
How about this thought? perl -e 'print while()' /etc/passwd This would print the content in /etc/passwd file. Here I just use shell's symbol to pass the file's content to perl script. -Original Message- From: Nath, Alok (STSD) [EMAIL PROTECTED] Sent: Mar 13, 2007 8:41 PM To: beginners@perl.org Subject: Automating a perl script by another perl script Hi, I have a perl script which prompts user for certain inputs. I want to automate this by creating a separate script which runs the above perl file and probably passing the inputs in a separate text file. Can anybody give me some pointers or how to do this ? Thanks Alok. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ -- http://home.arcor.de/jeffpang/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Automating a perl script by another perl script
On 3/13/07, Nath, Alok (STSD) [EMAIL PROTECTED] wrote: Hi, I have a perl script which prompts user for certain inputs. I want to automate this by creating a separate script which runs the above perl file and probably passing the inputs in a separate text file. Can anybody give me some pointers or how to do this ? snip The open function can start a program and feed it data (like popen in C): open my $fh, '|perl other.pl' or die $!; open my $in, '', 'args'; while ($in) { print $fh $_; } If you need more control or bi-directional communication you should use IPC::Open2 (stdin and stdout) or IPC::Open3 (stdin, stdout, and stderr). Both are part of core Perl, so you should already have them installed. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Automating a perl script by another perl script
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 you could also give this a try: http://search.cpan.org/~rgiersig/Expect-1.20/Expect.pod On Mar 13, 2007, at 5:41 AM, Nath, Alok (STSD) wrote: Hi, I have a perl script which prompts user for certain inputs. I want to automate this by creating a separate script which runs the above perl file and probably passing the inputs in a separate text file. Can anybody give me some pointers or how to do this ? Thanks Alok. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.3 (Darwin) iD8DBQFF9uHJuT/QpFTX5YIRApSwAKDNGPkfmKXDn3rD12ay/b9bDolXggCgjEOr 2HYGU3UGHkH+Hsxgh8dIphE= =9+0X -END PGP SIGNATURE- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Automating a perl script by another perl script
Jeff Pang schreef: perl -e 'print while()' /etc/passwd That (is not an answer to OP's question, but) can also be written as: perl -pe1 /etc/passwd and even as cat /etc/passwd -- Affijn, Ruud Gewoon is een tijger. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/