For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > January 2007 > Re: confusion with splitting columns using [-n, -n] (e.g; my ( $country, $bytes ) = (









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: confusion with splitting columns using [-n, -n] (e.g; my ( $country, $bytes ) = (
jeevs

2007-01-30, 3:58 am



On Jan 30, 1:21 pm, "jeevs" <jeevan.ing...@gmail.com> wrote:
> -2 and -1 are the indexes used by split which tells -1 is the last
> column selected by split in your case its the bytes column. and -2 is
> the country column.


To add more the syntax used that is
(split)[-1,-2];

is nothing more than split used like

@arr = split (//,$string) ;
and then later
accessing array with indexes i.e @arr[-1,-2];

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com