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.
  • #!/usr/bin/perl

    use strict;
    use warnings;

    my @a = (
                    1,
                    @{[map {()} warn "in here\n"]},
                    2,
                    3
    );

    print map { "$_\n" } @a;

    • or the slightly less stupid (I don't know why I threw it in an arrayref to start with):

      #!/usr/bin/perl

      use strict;
      use warnings;

      my @a = (
                      1,
                      (map {()} warn "in here\n"),
                      2,
                      3
      );

      print map { "$_\n" } @a;

      • An even shorter way to write that is this:

        (map {;} warn "in here\n")

        However, I prefer to take a page from Javascript, by defining the following amusing function:

        sub void {}

        I can then write the code in this much nicer way:

        (void warn "in here\n")

        This is far nicer than Ovid’s approach as well, IMO.