p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Perl (http://p2p.wrox.com/forumdisplay.php?f=196)
-   -   Perl help (http://p2p.wrox.com/showthread.php?t=56708)

ZORCH April 15th, 2007 09:27 PM

Perl help
 
How can I open a system program multiple times.

#!/usr/bin/perl
use warnings;
use strict;
system ("notepad.exe");
#How can I make this program open as much times as I want?


ciderpunx April 18th, 2007 08:18 AM

Use a loop. Pehaps something like:

Code:

#!/usr/bin/perl
use warnings;
use strict;

print "Run program? (y/n)"; # ask if we should run program
while(<> !~ /^n/i) {        # while our user doesn't reply with a line that starts 'n'
   print "\n";              # print a blank line
   system ("notepad.exe");  # run program
   print "Another? (y/n)";  # ask if we want another instance of the program run
}

--
Charlie Harvey's website - linux, perl, java, anarchism and punk rock: http://charlieharvey.org.uk

ZORCH April 25th, 2007 11:54 AM

Thank you kid sir:D


ZORCH April 25th, 2007 12:09 PM

Quote:

quote:Originally posted by ZORCH
 Thank you ciderpunx:D




All times are GMT -4. The time now is 01:13 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.