Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

23 lines (15 sloc) 0.352 kb
#!/usr/bin/env perl
=head1 DESCRIPTION
You have coordinates of 2 points and need to find the distance between them.
=cut
use strict;
use warnings;
while (<DATA>) {
chomp;
my ( $x1, $y1, $x2, $y2 ) = grep { /\d/ } split /[^\d-]/;
print sqrt( ( $x1 - $x2 )**2 + ( $y1 - $y2 )**2 ), "\n";
}
exit(0);
__DATA__
(25, 4) (1, -6)
(47, 43) (-25, -11)
Jump to Line
Something went wrong with that request. Please try again.