Whitespace is irrelevant
p r i n t "Hello, world"; doesn't print "Hello, world" though, so you can't just put whitespace anywhere.
Also $x = "Hello"; print "$ x" will print "Hello" but @x = "Hello"; print "@ x" will print "@ x", and @$ x, $# x and $ #x are all syntax errors unless you remove the spaces.
#Edited: added those examples use feature 'say'; our $x = "Hello"; our @y = "Hi"; our $z = ["Bonjour"]; while (<DATA>) { chomp; print "$_ \t"; no warnings; eval "$_; 1" or say $@ =~ tr/\n/ /r; } __DATA__ say "$x"; say "$ x"; say "@y"; say "@ y"; say @ y; say $#y; say $# y; say $ #y; say @ $z; say @$ z;
say "$x"; Hello say "$ x"; Hello say "@y"; Hi say "@ y"; @ y say @ y; Hi say $#y; 0 say $# y; syntax error at (eval 6) line 2, at EOF (Might be a +runaway multi-line ;; string starting on line 1) say $ #y; syntax error at (eval 7) line 1, at EOF say @ $z; Bonjour say @$ z; syntax error at (eval 9) line 1, near "@$ z"

If you [...] insert [...] white spaces between sigils and identifiers, you are somehow shooting on your own feet.
If you do it on purpose yes, but it's pretty easy to do it by mistake, either because of a typo, or because you expected spaces to be relevant inside a string, or even in some cases without noticing what's wrong, and perl may not warn you:
use v5.14; use strict; use warnings; use constant MASK => 0xF0; use constant VAL => 0x0F; sub get_val1 { VAL } sub get_val2() { VAL } sub get_mask { MASK } # Is & a function sigil or the bitwise and? say VAL & get_mask; say get_val1 & get_mask; say get_val1 & MASK; say get_val2 & MASK; say get_val1() & MASK;
0 15 15 0 0


In reply to Re^2: What for sigils were allowed to be separated from identifiers? by Eily
in thread What for sigils were allowed to be separated from identifiers? by vr

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.