in reply to Re: (lestrrat) Re: Trying to simulate a CLI using hashes...
in thread Trying to simulate a CLI using hashes...

No no, don't put them parathesis! That makes perl evaluate the subroutine, and put the ref to the result of the sub in the hash

my $rv = mysub(); ## sub is executed. normal my $rv = &mysyb(); ## same as above, but bad style, I think my $rv = \&mysub; ## ref to the subroutine <- this is what we +want my $rv = \&mysub(); ## ref to the return value of the subroutine my $rv = \{ &mysub() }; ## same as above

UPDATE: wog corrected me: "\{ &mysub() } creates a reference to a refrence to a hash generated from mysub() returns in list context,". I apologize for the mistake :-(