Bug 15258: Fix Perl scripts declaring unused variables
[koha.git] / Koha / QueryParser / Driver / PQF / Util.pm
index 5d9ed71..99e36f0 100644 (file)
@@ -41,11 +41,9 @@ Convert a hashref with a Bib-1 mapping into its PQF string representation.
 sub attributes_to_attr_string {
     my ($attributes) = @_;
     my $attr_string = '';
-    my $key;
-    my $value;
-    while (($key, $value) = each(%$attributes)) {
+    foreach my $key ( sort keys %{$attributes} ) {
         next unless looks_like_number($key);
-        $attr_string .= ' @attr ' . $key . '=' . $value . ' ';
+        $attr_string .= ' @attr ' . $key . '=' . $attributes->{ $key } . ' ';
     }
     $attr_string =~ s/^\s*//;
     $attr_string =~ s/\s*$//;