update:perl -le"print for @{[1,2,3,4,5,6]}[2..5]" perl -le"$_=[1..7];print for @{$_}[-1,-2]"
# also, to give you some insight perl -le"@_=(1..7);print for $_[-1,-2]" perl -le"$_=[1..7];print for $_->[-1,-2]" # and perl -MO=Deparse -le"$_=[1..7];print for $_->[-1,-2]" $_ = [(1, 2, 3, 4, 5, 6, 7)]; foreach $_ ($$_['???', -2]) { print $_; } # and perl -MO=Deparse -le"@_=(1..7);print for $_[-1,-2]" @_ = (1, 2, 3, 4, 5, 6, 7); foreach $_ ($_['???', -2]) { print $_; } #and perl -MO=Deparse -le"$_=[1..7];print for @$_[-1,-2]" $_ = [(1, 2, 3, 4, 5, 6, 7)]; foreach $_ (@$_[-1, -2]) { print $_; }
| ______crazyinsomniac_____________________________ Of all the things I've lost, I miss my mind the most. perl -e "$q=$_;map({chr unpack qq;H*;,$_}split(q;;,q*H*));print;$q/$q;" |
In reply to (crazyinsomniac) Re: Slicing a reference?
by crazyinsomniac
in thread Slicing a reference?
by drix
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |