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

  • Home
  • SEARCH
  • 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 179593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T14:26:03+00:00 2026-05-11T14:26:03+00:00

I just discovered that perl ignores space between the sigil and its variable name

  • 0

I just discovered that perl ignores space between the sigil and its variable name and was wondering if someone could tell me if this was the expected behaviour. I’ve never run into this before and it can result in strange behaviour inside of strings.

For example, in the following code, $bar will end up with the value ‘foo’:

my $foo = 'foo'; my $bar = '$                     foo'; 

This also works with variable declarations:

my $    bar = 'foo\n'; print $bar; 

The second case doesn’t really matter much to me but in the case of string interpolation this can lead to very confusing behaviour. Anyone know anything about this?

  • 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. 2026-05-11T14:26:03+00:00Added an answer on May 11, 2026 at 2:26 pm

    Yes, it is part of the language. No, you should not use it for serious code. As for being confusing in interpolation, all dollar signs (that are not part of a variable) should be escaped, not just the ones next to letters, so it shouldn’t be a problem.

    I do not know if this is the real reason behind allowing whitespace in between the sigil and the variable name, but it allows you to do things like

    my $            count = 0; my $file_handle_foo   = IO::File->new; 

    which might be seen by some people as handy (since it puts the sigils and the unique parts of the variable names next to each other). It is also useful for Obfu (see the end of line 9 and beginning of line 10):

    #!/usr/bin/perl -w                                      # camel code use strict;                                             $_='ev                                        al('seek\040D            ATA,0,                  0;');foreach(1..3)        {<DATA>;}my               @camel1hump;my$camel;   my$Camel  ;while(             <DATA>){$_=sprintf('%-6 9s',$_);my@dromedary           1=split(//);if(defined($ _=<DATA>)){@camel1hum        p=split(//);}while(@dromeda  ry1){my$camel1hump=0      ;my$CAMEL=3;if(defined($_=shif         t(@dromedary1    ))&&/\S/){$camel1hump+=1<<$CAMEL;}        $CAMEL--;if(d   efined($_=shift(@dromedary1))&&/\S/){       $camel1hump+=1  <<$CAMEL;}$CAMEL--;if(defined($_=shift(      @camel1hump))&&/\S/){$camel1hump+=1<<$CAMEL;}$CAMEL--;if(      defined($_=shift(@camel1hump))&&/\S/){$camel1hump+=1<<$CAME      L;;}$camel.=(split(//,'\040..m`{/J\047\134}L^7FX'))[$camel1h       ump];}$camel.='\n';}@camel1hump=split(/\n/,$camel);foreach(@       camel1hump){chomp;$Camel=$_;y/LJF7\173\175`\047/\061\062\063\       064\065\066\067\070/;y/12345678/JL7F\175\173\047`/;$_=reverse;        print'$_\040$Camel\n';}foreach(@camel1hump){chomp;$Camel=$_;y         /LJF7\173\175`\047/12345678/;y/12345678/JL7F\175\173\0 47`/;          $_=reverse;print'\040$_$Camel\n';}';;s/\s*//g;;eval;   eval            ('seek\040DATA,0,0;');undef$/;$_=<DATA>;s/\s*//g;(   );;s              ;^.*_;;;map{eval'print\'$_\'';}/.{4}/g; __DATA__   \124                \1   50\145\040\165\163\145\040\157\1 46\040\1  41\0                     40\143\141  \155\145\1 54\040\1   51\155\  141                     \147\145\0  40\151\156 \040\141    \163\16 3\                      157\143\   151\141\16  4\151\1     57\156                      \040\167  \151\164\1   50\040\      120\1                      45\162\   154\040\15    1\163\      040\14                      1\040\1   64\162\1      41\144       \145\                      155\14    1\162\       153\04        0\157                       \146\     040\11     7\047\         122\1                       45\15      1\154\1  54\171          \040                       \046\         012\101\16            3\16                       3\15           7\143\15             1\14                       1\16            4\145\163           \054                      \040            \111\156\14         3\056                     \040\         125\163\145\14         4\040\                     167\1        51\164\1  50\0         40\160\                   145\162                              \155\151                 \163\163                                \151\1               57\156\056 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 281k
  • Answers 281k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Yes, but you'd consume them as web services. Just use… May 13, 2026 at 3:53 pm
  • Editorial Team
    Editorial Team added an answer struct record { char *name; int refcount : 4; unsigned… May 13, 2026 at 3:53 pm
  • Editorial Team
    Editorial Team added an answer set dataType $.ajax({ type: "POST", url: "KMS-backend.php", data: "&checkdivpage="+pagename ,… May 13, 2026 at 3:53 pm

Related Questions

I finally have finished a Web Application and now I have to make it
I have an existing Perl script that uses the FTP object to send a
I have Perl script and need to determine the full path and filename of
For Delphi developers, a company called Peganza created two useful sourcecode analysers: Pascal Analyzer

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.