Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re^2: Why doesn't "my ($x) = @);" generate a syntax error?

by Grimy (Pilgrim)
on Jun 13, 2013 at 17:57 UTC ( #1038812=note: print w/replies, xml ) Need Help??

in reply to Re: Why doesn't "my ($x) = @);" generate a syntax error?
in thread Why doesn't "my ($x) = @);" generate a syntax error?

Correction: for any punctuation character x except '[' and '{', there exist global variables $x, @x and %x. Those variables are not necessarily magic, and their existence doesn't depend on the fact that $x does something useful. For example, none of $}, @} and %} are magic, yet they are all global variables.
  • Comment on Re^2: Why doesn't "my ($x) = @);" generate a syntax error?

Replies are listed 'Best First'.
Re^3: Why doesn't "my ($x) = @);" generate a syntax error?
by tobyink (Abbot) on Jun 13, 2013 at 23:31 UTC

    $[, @[ and %[ work (or at least they do in 5.18.0). If ${, @{ and %{ were to work, that would break dereferencing.

    package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1038812]
[nysus]: What happened to the submit button? All I have is a preview button.
[erix]: perlmonks has become read-only ?
[marto]: erix unlikely, we've had posts within the last few minutes ;)
[ambrus]: nysus: make sure you enter at least two lines for the title and then preview, and read warnings the preview form prints
[davies]: There is an option (I have it set) to force preview before submission. Perhaps your option has been set (accidentally?) and you are not expecting it.
[ambrus]: sorry, I mean at least two words for the title and then preview
[ambrus]: davies: that option is the default. and it's not really "force", it just hides the button.
[marto]: yes, not reading the errors displayed has been a cause of this type of report in the past
[nysus]: Ambrus, ah. I think that was the problem. I'll try. Thanks!

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (16)
As of 2017-12-15 11:29 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (431 votes). Check out past polls.