::::::::::::::
one
::::::::::::::
#!/usr/bin/perl

print "Oh, I see you want the number of times to be ", $ARGV[0], " times.\n"; 

@names = ( "david", "roy", "leigh", "remi", "ryan", "adam sweeny", "adam myers", "terry", "joe", "alexandra" ); 

# for ($index = 0; $index <= $#names; $index += 1) {
#   print $names[$index], "\n"; 
# }

# foreach $name (@names) {
#   print $name, "\n"; 
# }

# %dictionary = ("david" => 13, "roy" => 10, "leigh" => 12, "remi" => 16); 

# $username = <STDIN>; 
# chop($username); 

# print $username, " has been selected ", $dictionary{$username}, " times.\n"; 

%dictionary = ();

foreach $name (@names) {
  $dictionary{$name} = 0; 


foreach $key (keys %dictionary) {
  print $key, " --> ", $dictionary{$key}, "\n"; 
}

print "-----------------------------\n"; 

$tries = $ARGV[0] ; 

for ($i = 0; $i < $tries; $i++) {
  $index = int(rand(10000)); 
  $index = $index % ($#names + 1); 
  $username = $names[$index];
  # print $username, "\n"; 
  $dictionary{$username} += 1; 


foreach $key (keys %dictionary) {
  print $key, " --> ", $dictionary{$key}, "\n"; 
}

::::::::::::::
two
::::::::::::::
#!/usr/bin/perl

foreach $value (@ARGV) {
  print $value, "\n"; 
}
::::::::::::::
three
::::::::::::::
#!/usr/bin/perl

use CGI; 

$object = new CGI;

print $object->header, $object->start_html; 

$times = $object->param('times'); 

if ($times <= 0) {
  print qq{<form>
             How many times?<input type="text" name="times"/>
             <input type="submit" value="Go!"/>
           </form> };
} else {
  @names = ( "david", "roy", "leigh", "remi", "ryan", "adam sweeny", "adam myers", "terry", "joe", "alexandra" ); 

  %dictionary = ();

  foreach $name (@names) {
    $dictionary{$name} = 0; 
  } 

  for ($i = 0; $i < $times; $i++) {
    $index = int(rand(10000)); 
    $index = $index % ($#names + 1); 
    $username = $names[$index];
    $dictionary{$username} += 1; 
  } 

  print "<table border=2 cellpadding=2>\n";

  foreach $key (keys %dictionary) {
    print "<tr><td>", $key, "</td><td>", $dictionary{$key}, "</td></tr>\n"; 
  }

  print "</table>\n";
}

print $object->end_html; 
::::::::::::::
four
::::::::::::::
#!/usr/bin/perl

$word = $ARGV[0]; 

if ($word eq "bye") {
  print "OK, see you later.\n"; 
} else {
  print "You want to go on.\n"; 
}