#!/usr/bin/perl -w use strict; use Imager::Graph::Util; my ($ax, $ay, $bx, $by, $cx, $cy, $dx, $dy) = GetLines(); # you have to write that subroutine my @line1 = line_from_points($ax, $ay, $bx, $by); my @line2 = line_from_points($cx, $cy, $dx, $dy); # @p will contain the (x, y) point of intersection if it exists my @p = intersect_lines(@line1, @line2);