Skip to content

Instantly share code, notes, and snippets.

@kan
Created January 27, 2011 06:49
Show Gist options
  • Save kan/798174 to your computer and use it in GitHub Desktop.
Save kan/798174 to your computer and use it in GitHub Desktop.
sub _normalize {
my $value = shift;
if ( $value =~ /^([-+]?)(\d+)\.(\d+)\.([0-9.]+)$/ ) {
my $degree = int($2) + int($3) / 60 + $4 / 3600;
$degree *= -1 if $1 && $1 eq '-';
return $degree;
}
else {
return $value;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment