#!/usr/bin/perl
# Calculate how big my state, island etc. would compare to a feature
# on the Moon, (which are often circular (craters, etc.) and thus
# often described by diameters.)
# Usage example: $ echo Taiwan 36000 | ./$0 #Square km.
# Copyright       : https://www.fsf.org/copyleft/gpl.html
# Author          : Dan Jacobson -- https://www.jidanni.org/
# Created On      : Sat Feb 27 07:01:31 2021
# Last Modified On: Sat Feb 27 07:17:22 2021
# Update Count    : 10
use strict;
use warnings q(all);
use Math::Trig;
while (<>) {
    my @F = split;
    printf << 'EOF', @F, 2 * sqrt( $F[1] / pi ), sqrt $F[1];
%s, with an area of %.0f km2,
is like a crater on the Moon with diameter %.0f km.
(Or a square, with sides %.0f km. long.)
EOF
}
