while( my( $key, $val ) = each( %{ testa() } ) { print "Key: $key\tValue: $val\n"; } sub testa { my %s = ( a => 10, b => 20, c => 30 ); return \%s; }