Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6853215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:29:07+00:00 2026-05-27T01:29:07+00:00

In this code snippet: use strict; use warnings; use Data::Dumper; my $r = [qw(testing

  • 0

In this code snippet:

    use strict;
    use warnings;
    use Data::Dumper;
    my $r = [qw(testing this thing)];

    print Dumper($r);
    foreach my $row (@({$r})
    {
        print "$row\n";
        $row .= 'mod';
    }
    print Dumper($r);
    print Dumper(@({$r});

I figured out that the ‘(‘ after the ‘@‘ in the foreach is causing this not to loop correctly. I have no idea why this code even works as there is no ending parenthesis. What is this doing? It looks to be creating a new variable on the fly, but shouldn’t ‘use strict‘ have fired or something?

Please help explain what that ‘@(‘ is doing and why it still runs without an ending parenthesis.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T01:29:08+00:00Added an answer on May 27, 2026 at 1:29 am

    That is a hash slice of the %( variable, which being part of the *( glob, is exempt from strict vars. This is true for variables that Perl has predefined, in this case $( and also for all of the other glob slots for the names of punctuation variables. All punctuation variables are global across all packages, and their fully qualified names are the short forms: $), @), %), &)… Since strict 'vars' does not apply to fully qualified names, none of these names are errors.

    Expanding a bit:

    @({$r};
    @{(}{$r};
    @{'main::('}{$r};  # needs strict refs to be off
    

    Those lines are all equivalent.

    With use warnings; perl will let you know that it would be better to write a slice of a single value with a $ sigil:

    $({$r};
    ${(}{$r};
    ${'main::('}{$r};  # needs strict refs to be off
    

    Which in trying to resolve a typo would have pointed you in the right spot. Which is why you should always use both warnings and strictures.

    For more detail, the perlvar manpage shows all of the punctuation variables with at least one sigil or another. And if you wanted a reference about the scoping of punctuation variables, the package docs have that.


    All the punctuation variables are also immune to used only once warnings, and that might be a bug…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need some Perl regular expression help. The following snippet of code: use strict;
I've got trouble on how to print my hash contents. Code snippet as this,
This code snippet gets a Json data from a API hosted in my localhost.
I use this code snippet to obtain a file as an input stream. The
I use this code snippet that verifies if the file specified in the URL
I read the Use AsyncCallback , there is this code snippet: using System; using
Passing this code through jsHint: var A = function (spec) { use strict; var
This code snippet is from C# in Depth static bool AreReferencesEqual<T>(T first, T second)
Take this code snippet for example: window.location.href = 'mysite.htm#images'; Already being on the site
VS 2008 I have this code snippet I found on a VB website. But

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.