#! /usr/bin/perl my ($px, $py); while (<>) { my ($ix, $iy) = /^(\d+) (\d+)$/ or die; my ($x) = ($ix - 206) / (436 - 206) * (28 - 23) + 23; my ($y) = ($iy - 126) / (287 - 126) * (60 - 0) + 0; printf "%.2f %.2f\n", $x, $py if defined $py; printf "%.2f %.2f\n", $x, $y; ($px, $py) = ($x, $y); }