Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Arrow Operator Oddment

by MeowChow (Vicar)
on Jun 03, 2002 at 09:28 UTC ( #171177=perlquestion: print w/replies, xml ) Need Help??
MeowChow has asked for the wisdom of the Perl Monks concerning the following question:

Wherefore does the following code work?
@l = 0..10; %h = (a => 1, b => 2); print @l->[4]; # prints 4 print %h->{b}; # prints 2
My reading of perlop has me convinced that this is an unintended syntactic feature.
               s aamecha.s a..a\u$&owag.print

Replies are listed 'Best First'.
Re: Arrow Operator Oddment
by Abigail-II (Bishop) on Jun 03, 2002 at 09:42 UTC
    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.


      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;

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://171177]
Approved by Dog and Pony
[shmem]: Lady_Aleena: perl -MMP3::Tag -MFile::Find -le 'find(sub{if($File ::Find::name=~/\. mp3$/){$sum+=MP3:: Tag->new($_)-> interpolate("\%S ")} }, "Music"); print "total seconds: $sum"'
[Lady_Aleena]: shmem, sorry I was outside for a moment moving my car out of hubby's way.
[Lady_Aleena]: shmem, there is ONE song which throws a wrench in the works for both MP3::Info and MP3::Tag.

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2017-04-23 22:06 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (432 votes). Check out past polls.