in reply to Using pos() inside given/when

Use for() instead of given():

... for ( $h->{s} ) {... ...

Output:

1 3 5