print "What is input file name?: "; chomp($input = ); print "What is output file name: "; chomp($output = ); open (INPUT, "$input") || die "died opening input\n";#opening up ngc188cata and putting it into INPUT# open (STDOUT, ">$output") || die "died opening output\n"; #opening up ngc188cat2 and setting output of out# $cfo = "O"; $status = "STATUS=OK"; $m = "^M"; open (INTER, ">>fred"); while ($inline = ) { #INPUT defined as variable# @mag = split(/\s+/, $inline); #firstline of array defined by split of white space into variable inline# ############################################# if ($mag[12] >= 12 && $mag[12] <= 20) { print INTER "$inline"; #printing to INTER } } while ($sep = ) { @firstline = split(/\s+/, $sep); $hms1 = $firstline[2]; $rah2 = ($hms1 / 15); $rah3 = int($rah2); $ram1 = ( abs($rah2 - $rah3) )* 60; $ram2 = int($ram1); $ras1 = abs($ram1 - $ram2) * 60; $ras2 = sprintf "%-02.3f", $ras1 ; $hms2 = $firstline[3]; $hh2 = sprintf "%1d", ($hms2); $mm2 = sprintf "%02d", (60*( abs($hms2) - abs($hh2) ) ); $ss2 = sprintf "%-02.2f", 3600*abs($hms2) - 3600*abs($hh2) - 60*abs($mm2); $obid = "NGC 188 - $firstline[1]"; write; #writing to STDOUT } close INPUT;