bazz

07-02-2005, 09:25 PM

I'm stuck here both in terms of how to think it through and then, how to write it :eek:

edit: just had inspiration as I re-read this... is it as simple as finding out how many 'numbers' there are per kilometres and, then changing the line

$distanceEastWest = ($baseEastings - $nearbyEastings); TO

$distanceEastWest = ($baseEastings - $nearbyEastings / 10);

ie, divide by 10 if there are ten to the Km?

/edit:

my $clientGrid = "34567898";

my ( $baseNorthings , $baseEastings ) = ($clientGrid =~ /(....)/g);

baseNorthing is therefore 3456

baseEasting is therefore 7898

That bit is OK but then I use the code

my $nearbyEastings = "34567890";

my $nearbyNorthings = "45678987";

$distanceEastWest = ($baseEastings - $nearbyEastings);

if ($baseEastings > $nearbyEastings) {

print <<EOF;

$business is $distanceEastWest West of $clientBusiness

EOF

} elsif ($baseEastings < $nearbyEastings) {

print <<EOF;

$business is $distanceEastWest East of $clientBusiness

EOF

} elsif ($baseNorthings == $nearbyNorthings) {

print <<EOF;

This $businessType is on the same Northing as $clientBusiness

EOF

}

This simply ads and subtracts the portions of numbers and prints the numerical difference between them.

I need to find out how to convert the difference between the numbers (not necessarily the numbers themselves), to be able to print

This $businessType is XX kilometres East/West/North/South of $clientBusiness

[/code]

Please if any of you can give me a tip or hint, I'll be a happy teddy bear.

Bazz

edit: just had inspiration as I re-read this... is it as simple as finding out how many 'numbers' there are per kilometres and, then changing the line

$distanceEastWest = ($baseEastings - $nearbyEastings); TO

$distanceEastWest = ($baseEastings - $nearbyEastings / 10);

ie, divide by 10 if there are ten to the Km?

/edit:

my $clientGrid = "34567898";

my ( $baseNorthings , $baseEastings ) = ($clientGrid =~ /(....)/g);

baseNorthing is therefore 3456

baseEasting is therefore 7898

That bit is OK but then I use the code

my $nearbyEastings = "34567890";

my $nearbyNorthings = "45678987";

$distanceEastWest = ($baseEastings - $nearbyEastings);

if ($baseEastings > $nearbyEastings) {

print <<EOF;

$business is $distanceEastWest West of $clientBusiness

EOF

} elsif ($baseEastings < $nearbyEastings) {

print <<EOF;

$business is $distanceEastWest East of $clientBusiness

EOF

} elsif ($baseNorthings == $nearbyNorthings) {

print <<EOF;

This $businessType is on the same Northing as $clientBusiness

EOF

}

This simply ads and subtracts the portions of numbers and prints the numerical difference between them.

I need to find out how to convert the difference between the numbers (not necessarily the numbers themselves), to be able to print

This $businessType is XX kilometres East/West/North/South of $clientBusiness

[/code]

Please if any of you can give me a tip or hint, I'll be a happy teddy bear.

Bazz