Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re: Arrow Operator Oddment

by Abigail-II (Bishop)
on Jun 03, 2002 at 09:42 UTC ( #171179=note: print w/replies, xml ) Need Help??

in reply to Arrow Operator Oddment

My reading of perlop has me convinced that this is an unintended syntactic feature.

And that's exactly what it is. When using the arrow, Perl will see whatever is left of it as a reference. Including if you have something like @l or %h.

Note that you will get the warning
Using an array as a reference is deprecated
in Perl 5.8.0.


Replies are listed 'Best First'.
(MeowChow) Re2: Arrow Operator Oddment
by MeowChow (Vicar) on Jun 03, 2002 at 09:58 UTC
    Deprecated, eh? Somehow I don't get the impression that it was ever precated to begin with... :-)
                   s aamecha.s a..a\u$&owag.print
      Can you explain that a bit for those less enlightened monks?

      I'm a bit baffled. I don't see what the problem is.

      ($_='jjjuuusssttt annootthheer pppeeerrrlll haaaccckkeer')=~y/a-z//s;print;

        The problem is: MeowChow created a normal Array and a normal Hash:

        @l = 0..10; %h = (a => 1, b => 2);

        But then read from them as if they were a reference to an array and a reference to a hash:

        print @l->[4]; # prints 4 print %h->{b}; # prints 2

        This would be the normal way to access the array and the hash:

        print $l[4]; # prints 4 print $h{b}; # prints 2
        Brigitte    'I never met a chocolate I didnt like'    Jellinek

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://171179]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2016-10-22 04:10 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (292 votes). Check out past polls.