Thread: Perl help
View Single Post
  #2 (permalink)  
Old April 18th, 2007, 08:18 AM
ciderpunx ciderpunx is offline
Friend of Wrox
Points: 1,515, Level: 15
Points: 1,515, Level: 15 Points: 1,515, Level: 15 Points: 1,515, Level: 15
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2003
Location: Oxford, , United Kingdom.
Posts: 488
Thanks: 0
Thanked 3 Times in 3 Posts
Default

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
Reply With Quote