weidagang2046的專欄

          物格而后知致
          隨筆 - 8, 文章 - 409, 評論 - 101, 引用 - 0
          數據加載中……

          ref函數判斷變量是何種類型的引用

          ??? ref EXPR
          ??? ref???? Returns a non-empty string if EXPR is a reference, the empty
          ??????????? string otherwise. If EXPR is not specified, $_ will be used. The
          ??????????? value returned depends on the type of thing the reference is a
          ??????????? reference to. Builtin types include:

          ??????????????? SCALAR
          ??????????????? ARRAY
          ??????????????? HASH
          ??????????????? CODE
          ??????????????? REF
          ??????????????? GLOB
          ??????????????? LVALUE

          ??????????? If the referenced object has been blessed into a package, then
          ??????????? that package name is returned instead. You can think of "ref" as
          ??????????? a "typeof" operator.

          ??????????????? if (ref($r) eq "HASH") {
          ??????????????????? print "r is a reference to a hash.\n";
          ??????????????? }
          ??????????????? unless (ref($r)) {
          ??????????????????? print "r is not a reference at all.\n";
          ??????????????? }
          ??????????????? if (UNIVERSAL::isa($r, "HASH")) {? # for subclassing
          ??????????????????? print "r is a reference to something that isa hash.\n";
          ??????????????? }

          ??????????? See also perlref.

          ?

          posted on 2006-05-09 00:16 weidagang2046 閱讀(1682) 評論(0)  編輯  收藏 所屬分類: Perl

          主站蜘蛛池模板: 枣阳市| 航空| 玛沁县| 江西省| 吴桥县| 江口县| 溧阳市| 水城县| 城市| 鹿邑县| 华阴市| 肇州县| 渭源县| 双江| 伊宁县| 石楼县| 新竹县| 青海省| 靖远县| 太仆寺旗| 新建县| 股票| 恩平市| 柳林县| 勐海县| 新安县| 科技| 县级市| 额济纳旗| 精河县| 常德市| 鹿泉市| 枝江市| 收藏| 衢州市| 监利县| 辰溪县| 洪湖市| 岐山县| 三原县| 特克斯县|