#!/usr/bin/perl
#
# Go through the GCVS data files to print out stars of interest
# 
$debug = 0;

while (<STDIN>) {
  $line = $_;

  @words = split(/\|/, $line);
  $name = $words[1];
  $radec = $words[3];
  $type = $words[4];
  $maxmag = $words[5];
  $minmag = $words[6];
  $period = $words[10];

  if ($debug > 0) {
    printf "name $name  type $type  maxmag $maxmag  period $period \n";
  }

  $amplitude = $minmag - $maxmag;

  # figure out the Dec, roughly
  $dec_sign = substr($radec, 8, 1);
  $dec_deg = substr($radec, 9, 2);
   
  # figure out the RA, roughly
  $rah = substr($radec, 0, 2);


  if (($period > 0.0) && ($period < 3.0)) {
    if ($minmag < 13.0) {
      if (($dec_sign eq "+") && ($dec_deg < 50)) {
          printf "name $name  $radec type $type  %6.3f %6.3f  per @ %5.1f \n", 
                $maxmag, $minmag, $period;
      }
    }
  }

}


exit 0;
