Re: confusion with splitting columns using [-n, -n] (e.g; my ( $country, $bytes ) = ( split )[ -2, -1 ])
- From: "Paul Lalli" <mritty@xxxxxxxxx>
- Date: 30 Jan 2007 03:46:57 -0800
On Jan 30, 12:35 am, daem0n...@xxxxxxxxx (Michael Alipio) wrote:
Someone has given me this code:
[ . . . ]
my ( $country, $bytes ) = ( split )[ -2, -1 ];
It is working perfectly but now, I need to document this code.
Can anyone help me out on understanding this code.
I have a dumb question. Why aren't you just asking whoever gave you
the code in the first place?
I'm particularly confused with the line:
"my ($country, $bytes) = (split) [-2, -1];
What does this tells? What does -2 and -1 tells?
It's a list slice. Read about slices in:
perldoc perldata
or online at:
http://perldoc.perl.org/perldata.html#Slices-slice-array%2c-slice-hash
%2c-slice
Paul Lalli
.
- Prev by Date: Re: Free to wrong pool..
- Next by Date: Re: I don't know where to start with this one.
- Previous by thread: Re: confusion with splitting columns using [-n, -n] (e.g; my ( $country, $bytes ) = ( split )[ -2, -1 ])
- Next by thread: Re: confusion with splitting columns using [-n, -n] (e.g; my ( $country, $bytes ) = ( split )[ -2, -1 ])
- Index(es):