Thank you for
all your good work for Perl on CPAN! I use your Astro modules constantly to
power my planetariums and clocks. I'd like to see your 30 lines. Here
is one that puts SIMBAD data in a perl hash:
perl -MAstro::SIMBAD::Client -MData::Dumper -le '$s=Astro::SIMBAD::Cli
+ent->new;@s=split/\n/,$s->url_query(id => Ident => "$ARGV[0]", NbIden
+t => 1);splice(@s,0,7);splice(@s,20,$#s+1);%s=map{/([^:]+\S)\s?:\s+(\
+S.*)/;$1=>$2}@s;@s=grep/^Coord/,keys%s;print"$_: $s{$_}"for@s;print q
+q[\n$s{"Proper motions"}\n];print Dumper\%s;' sirius
Prints coordinates and proper motions and dumps the hash:
Coordinates(Gal,ep=J2000,eq=2000): 227.23029126 -08.89028121
Coordinates(ICRS,ep=J2000,eq=2000): 06 45 08.91728 -16 42 58.0171 (Op
+t ) A [11.70 10.90 90] 2007A&A...474..653V
Coordinates(FK4,ep=B1950,eq=1950): 06 42 56.72452 -16 38 45.4080
-546.01 -1223.07 [1.33 1.24 0] A 2007A&A...474..653V
$VAR1 = {
'Angular size' => '~ ~ ~ (~) ~ ~',
'Coordinates(Gal,ep=J2000,eq=2000)' => '227.23029126 -08.89
+028121 ',
'Spectral type' => 'A0mA1Va C 2003AJ....126.2048G',
'Parallax' => '379.21 [1.58] A 2007A&A...474..653V',
'Flux V' => '-1.46 [~] C 2002yCat.2237....0D',
'Flux I' => '-1.43 [~] C 2002yCat.2237....0D',
'Flux J' => '-1.36 [~] C 2002yCat.2237....0D',
'Flux R' => '-1.46 [~] C 2002yCat.2237....0D',
'Redshift' => '-0.000018 [0.000001] A 2006AstL...32..759G',
'Proper motions' => '-546.01 -1223.07 [1.33 1.24 0] A 2007A&
+A...474..653V',
'Flux K' => '-1.35 [~] C 2002yCat.2237....0D',
'Morphological type' => '~ ~ ~',
'Flux H' => '-1.33 [~] C 2002yCat.2237....0D',
'cz' => '-5.50 [0.40] A 2006AstL...32..759G',
'Flux U' => '-1.51 [~] C 2002yCat.2237....0D',
'Radial Velocity' => '-5.50 [0.4] A 2006AstL...32..759G',
'Flux B' => '-1.46 [~] C 2002yCat.2237....0D',
'Coordinates(ICRS,ep=J2000,eq=2000)' => '06 45 08.91728 -16
+ 42 58.0171 (Opt ) A [11.70 10.90 90] 2007A&A...474..653V',
'Coordinates(FK4,ep=B1950,eq=1950)' => '06 42 56.72452 -16
+38 45.4080',
'hierarchy counts' => '#parents=0, #children=0, #siblings=0'
};
PS - I think the easiest way to get deg2rad (and rad2deg) is a core module:
use Math::Trig 'deg2rad';
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.