Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • $p = [ { a => 1, b => 2, c => 3 }, “ant”, “bat”, “cat” ];
    Which of the following expression gives the value cat ?
    $p[3]
    $p->{c}
    $p->[4]
    $p->{bat}

    $p->[3] would be correct, and

    %x = qw(C Ritchie Perl wall C++ Stroustrup); print @x{C, C++}

    Error : should use % instead of @ in print function
    Displays Stroustrup
    Displays Ritchie
    Displays Ritchie Stroustrup

    This doesn't compile, but of course, they didn't use " in a bunc

    • $p = [ { a => 1, b => 2, c => 3 }, “ant”, “bat”, “cat” ];
      Which of the following expression gives the value cat ?
      $p[3]
      $p->{c}
      $p->[4]
      $p->{bat}

      $p->[3] would be correct, and

      I think you're forgetting about pseudo-hashes (but, of course, everyone should be forgetting about pseudo-hashes!)

      %x = qw(C Ritchie Perl wall C++ Stroustrup); print @x{C, C++}

      Error : should use % instead of @ in print function
      Displa