New improved route finding algorithm
[spider.git] / perl / DXUtil.pm
index 608102e8a393db0b87a2734374f013696c975624..512c30efcc0e35609c3d931f0c20bf172af517ef 100644 (file)
@@ -20,7 +20,7 @@ use vars qw(@month %patmap @ISA @EXPORT);
 require Exporter;
 @ISA = qw(Exporter);
 @EXPORT = qw(atime ztime cldate cldatetime slat slong yesno promptf 
-                        parray parraypairs phex shellregex readfilestr writefilestr
+                        parray parraypairs phex phash shellregex readfilestr writefilestr
                         filecopy ptimelist
              print_all_fields cltounix unpad is_callsign is_latlong
                         is_qra is_freq is_digits is_pctext is_pcflag insertitem deleteitem
@@ -194,7 +194,7 @@ sub parraypairs
        my $ref = shift;
        my $i;
        my $out;
-  
+
        for ($i = 0; $i < @$ref; $i += 2) {
                my $r1 = @$ref[$i];
                my $r2 = @$ref[$i+1];
@@ -205,6 +205,20 @@ sub parraypairs
        return $out;
 }
 
+# take the arg as a hash reference and print it out as such
+sub phash
+{
+       my $ref = shift;
+       my $out;
+
+       while (my ($k,$v) = each %$ref) {
+               $out .= "${k}=>$v, ";
+       }
+       chop $out;                                      # remove last space
+       chop $out;                                      # remove last comma
+       return $out;
+}
+
 sub _sort_fields
 {
        my $ref = shift;