#!/usr/bin/perl -w

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #  
# final_1.pl
# 
# assignment: Write a program that counts backwards from 99
#             to 11, printing out each number and whether
#             or not it's digits add up to 13
#
# Author: John Berry
# Date: 12/11/03
#
# Version 0.01
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #  

use strict;

# version history
my $VERSION = "0.01";

# starting number
my $number = 99;

# countdown loop
while($number > 10) {

  # match the two digits in our numbers
  $number =~ /(\d)(\d)/;

  print("$number : ");

  # check to see if they add up to 13 and print appropriately
  if(($1 + $2) == 13) {
    print("$1", " + ", " $2 is 13\n");
  } else { 
    print("nope\n");
  }

  # decrement loop
  $number--;
}
