{ # hold state stuff in a closure # this can be identical to an object hash data # but you only get one instance at any one time # with this simple setup my %state; sub get { } sub seek_pos { } # set your %state with init like new sub init { } }