Hi all,

Thanks for the answers to my previous questions.  I do appreciate it.

Today's stumper is this:

  sub decode([EMAIL PROTECTED]) returns Array {
      gather {
          for @list -> $elem {
              take $elem.isa(Array) ?? $elem[1] xx $elem[0] !! $elem;
          }
      }
  }
  decode( [3, "a"], "b", [1, "c"] ).perl.say; 

That prints:

  ("a", "a", "a", \"b", "c")

How do I dereference "b"?  Heck, why is it a reference in the first
place?

Actually, I have found one way to dereference is, but it seems wrong
and buggy (using a prefix ++):

  sub decode([EMAIL PROTECTED]) returns Array {
      gather {
          for @list -> $elem {
              take $elem.isa(Array) ?? $elem[1] xx $elem[0] !! ++$elem;
          }
      }
  }
  decode( [3, "a"], "b", [1, "c"] ).perl.say; 

Oddly, using the postfix ++ gives me the error message I expect:

  *** Can't modify constant item: VRef <Scalar::Const:0x32e37c8>
      at 99.pugs line 215, column 18-69
         99.pugs line 215, column 18-69

Cheers,
Ovid

--

Buy the book -- http://www.oreilly.com/catalog/perlhks/
Perl and CGI -- http://users.easystreet.com/ovid/cgi_course/

Reply via email to