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

Re: The mystery of $->[1]

by kcott (Archbishop)
on Jul 11, 2015 at 20:59 UTC ( [id://1134317]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    $ perl -MO=Deparse,-p -e 'my $l = ref $a eq "ARRAY" ? ($a->[0] || $->[
    +1]) : $a;'
    (my $l = ((ref($a) eq 'ARRAY') ? ($a->[0] || ($- > [1])) : $a));
    -e syntax OK
    
  2. or download this
        # Deal with the case of an item actually being an array ref to 1 o
    +r 2
        # hashrefs. Don't assign to $a or $b, as they're aliases to the or
    +ignal
        my $l = ref $a eq 'ARRAY' ? ($a->[0] || $->[1]) : $a;
        my $r = ref $b eq 'ARRAY' ? ($b->[0] || $->[1]) : $b;
    
  3. or download this
        my $l = ref $a eq 'ARRAY' ? ($a->[0] || $a->[1]) : $a;
        my $r = ref $b eq 'ARRAY' ? ($b->[0] || $b->[1]) : $b;
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (5)
As of 2024-03-28 15:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found