GNU social JP
  • FAQ
  • Login
GNU social JPは日本のGNU socialサーバーです。
Usage/ToS/admin/test/Pleroma FE
  • Public

    • Public
    • Network
    • Groups
    • Featured
    • Popular
    • People

Conversation

Notices

  1. Embed this notice
    Mark Gardner (mjgardner@social.sdf.org)'s status on Friday, 19-Jul-2024 02:47:10 JST Mark Gardner Mark Gardner
    • mhd
    • drmorr

    @mhd @drmorr If you want or need to be verbose, you can say the following in #Perl to get the number of elements in an array:

    ```
    scalar @array
    ```

    What that does is force an expression into a scalar context.

    But a lot of the time you *don’t* need to do that. For instance, this will do the right thing:

    ```
    $length = @array;
    ```

    As well as this:

    ```
    say 'There are four lights' if @lights == 4;
    ```

    More on context here: https://perldoc.perl.org/perldata#Context

    In conversation about 10 months ago from social.sdf.org permalink

    Attachments

    1. No result found on File_thumbnail lookup.
      perldata - Perl data types - Perldoc Browser
    • Embed this notice
      Mark Gardner (mjgardner@social.sdf.org)'s status on Friday, 19-Jul-2024 02:47:10 JST Mark Gardner Mark Gardner
      in reply to
      • mhd
      • drmorr

      @mhd @drmorr I love the #Perl #programming language because in so many places it obeys the Principle Of Least Surprise—but *only* if you’re a normal person and not a stuck-up Real Programmer.

      A normal person says, “Of course I can check how many things I have (elements in an array) by comparing to a number.”

      A “Real Programmer” throws a fit because arrays and numbers are not the same thing, dammit, and their job is to explain to the computer how to do *its* job, dammit.

      In conversation about 10 months ago permalink
      Haelwenn /элвэн/ :triskell: likes this.

Feeds

  • Activity Streams
  • RSS 2.0
  • Atom
  • Help
  • About
  • FAQ
  • TOS
  • Privacy
  • Source
  • Version
  • Contact

GNU social JP is a social network, courtesy of GNU social JP管理人. It runs on GNU social, version 2.0.2-dev, available under the GNU Affero General Public License.

Creative Commons Attribution 3.0 All GNU social JP content and data are available under the Creative Commons Attribution 3.0 license.