store information in hash and display number of keys.

I am trying to store this information (info and number) in hash. number is the key and info is value in a hash.i shown my code below.

    #!/usr/bin/perl
    use warnings;
    use strict;
 
    use XML::LibXML::Reader;
    my $file;open $file, 'formal.xml');
    my $reader = XML::LibXML::Reader->new( IO => $file ) or die ("unable to open file");
 
    while ( $reader->nextElement( 'DATA' ) ) {
     my $info = $reader->readOuterXml();
     $reader->nextElement( 'number' ); 
     my $number = $reader->readInnerXml(); 
     print( "num: $number\n" );
     print( " datainfo: $info\n" );
    

how can i store these num and datainfo in a hash. and how can i count number of keys in hash. I did like this but not working.

    my %nums =( "$number", $info);
 
    while ((my $keys, my $values) = each (%nums)) { 
     print ("NUMBER:$keys." =>"INFORMATION: ".$values." \n");
    }
 
    my $key_count = keys %nums;
    print "$key_count";
    } 
    close($file);
 
 

when i am trying to excute it,it gives only one number but i have more numbers. may be my hash contains one number? how can iterate my hash to sotre more number of elements.