Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

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]
[Eily]: LanX well since the onion is your eye you should see it everywhere
[marto]: sounds eye watering
[LanX]: oh your talking about my pic?
[Eily]: marto #SoSad
[holli]: duh
[marto]: I expect you to take a nice photo in Glasgow to replace this one :P
[Eily]: LanX yup, saw it when I checked your current rank
[LanX]: obviously the message is not clear enough if you only notice the onion now. ...

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

    Results (398 votes). Check out past polls.