srkaeppler has asked for the wisdom of the Perl Monks concerning the following question:
so here is an example of what the output should look like
233 NGC 188 - 233 0 38 40.024 85 00 21.93 F STATUS=OK
this is an example of what my code produces
12 NGC 188 - 12 6 6 31.217 85 33 30.70 O STATUS=OK
now what is important here is simply the numbers in the
middle which indicate Right Accension and Declination
the format output should look like (for example)
6 06 31.217 85 33 30.70
that zero attached to the front of the six is my problem, in my code, i am not sure how to make it so that way instead of a single digit _6(_ indicates a space), i can get an 06.
so here is the important code
The there are three things happening in the loop. the loops involving converting into the variables $mm1, $ss1, etc creating the numbers that will go into the final format below. Again my question is where would i change my code so that way i could print out 06 instead of just _6(where _ indicates a space)?while ($inline = <INPUT>) { #INPUT defined as variable# @firstline = split(/\s+/, $inline); #firstline of array defined by sp +lit of white space into variable inline# $hms1 = $firstline[2]; $hh1 = int ($hms1); $mm1 = int (60*( abs($hms1) - abs($hh1) ) ); $ss1 = 3600*abs($hms1) - 3600*abs($hh1) - 60*abs($mm1); $hms2 = $firstline[3]; $hh2 = int($hms2); $mm2 = int(60*( abs($hms2) - abs($hh2) ) ); $ss2 = 3600*abs($hms2) - 3600*abs($hh2) - 60*abs($mm2); $obid = "NGC 188 - $firstline[1]"; write; } close INPUT; format STDOUT = @>>> @<<<<<<<<<<<<<<<<<<< @# @# @#.### @# @# @#.## @ @<<<<<<<< $firstline[1], $obid, $hh1, $mm1, $ss1, $hh2, $mm2, $ss2, $cfo, $statu +s .
I hope this makes sense what i am asking, if it does not, please let me know and i will attempt to reword it a little bit better.
thank you very much!
Steve
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Formating question
by davido (Cardinal) on Aug 11, 2004 at 16:17 UTC | |
|
Re: Formating question
by idsfa (Vicar) on Aug 11, 2004 at 16:19 UTC | |
|
Re: Formating question
by Roger (Parson) on Aug 11, 2004 at 16:20 UTC | |
|
Re: Formating question
by Old_Gray_Bear (Bishop) on Aug 11, 2004 at 16:28 UTC |