+
+# does it look like a qra locator?
+sub is_qra
+{
+ return $_[0] =~ /^[A-Ra-r][A-Ra-r]\d\d[A-Xa-x][A-Xa-x]$/;
+}
+
+# does it look like a valid lat/long
+sub is_latlong
+{
+ return $_[0] =~ /^\s*\d{1,2}\s+\d{1,2}\s*[NnSs]\s+1?\d{1,2}\s+\d{1,2}\s*[EeWw]\s*$/;
+}
+
+# insert an item into a list if it isn't already there returns 1 if there 0 if not
+sub insertitem
+{
+ my $list = shift;
+ my $item = shift;
+
+ return 1 if grep {$_ eq $item } @$list;
+ push @$list, $item;
+ return 0;
+}
+
+# delete an item from a list if it is there returns no deleted
+sub deleteitem
+{
+ my $list = shift;
+ my $item = shift;
+ my $n = @$list;
+
+ @$list = grep {$_ ne $item } @$list;
+ return $n - @$list;
+}
+
+sub dxver
+{
+ my $s = shift;
+ my ($a, $b, $c, $d) = $s =~ /(\d+)\.(\d+)\.(?:(\d+)\.(\d+))?/;
+
+ my $v = sprintf( "%d.%03d", $a, $b) || 0;
+ my $br = sprintf( "%d.%03d", $c, $d) if defined $c;
+ $br ||= 0;
+
+ $main::build += $v;
+ $main::branch += $br;
+ return ($v, $br);
+}
+
+INIT {
+ ($VERSION, $BRANCH) = dxver(q$Revision$);
+}