
The usage is as such: $ ./practice.pl 9
In this example '9' is the single argument indicating that you'd like a list of nine random practice games. The default argument is 1. So if you just type 'practice.pl' at the prompt with no argument at all it will give you a single practice game.
This is what the output looks like:

========================= begin practice.pl
#! /usr/bin/perl
$sets = $ARGV[0] || 1;
@dart_sets = (
'27g Razors',
'24g Merv Kings',
'16g Unicorns',
);
@practice_games = (
'Three 101\'s',
'SIDO 501',
'DIDO 301',
'Cricket',
'Doubles',
'Paul Williams Challenge',
'Chase',
'20 Bulls',
'20 Sixties',
);
for ($i=1; $i <= $sets; $i++) {
$index1 = rand @dart_sets;
$darts = $dart_sets[$index1];
$index2 = rand @practice_games;
$game = $practice_games[$index2];
print "$i. play $game with $darts\n";
}
========================= end practice.pl
No comments:
Post a Comment