in reply to Using pos() inside given/when
Use for() instead of given():
... for ( $h->{s} ) {... ... [download]
Output:
1 3 5 [download]