Automatically call hash values that are subroutine references

前端 未结 7 2110
孤街浪徒
孤街浪徒 2021-01-06 07:02

I have a hash with a few values that are not scalar data but rather anonymous subroutines that return scalar data. I want to make this completely transparent to the part of

7条回答
  •  时光取名叫无心
    2021-01-06 07:19

    Yes you can. You can either tie hash to implementation that will resolve coderefs to their return values or you can use blessed scalars as values with overloaded mehods for stringification, numification and whatever else context you want to resolve automatically.

提交回复
热议问题