What you have here "@f[6,2..$#f]" is an array slice.  Any indexes appearing
within the brackets will be included.  If you wanted to exclude 0,1,and 6,
you could do it this way:

@f[2..5,7..$#f];

-----Original Message-----
From: Mike Singleton [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 12, 2002 11:07 AM
To: [EMAIL PROTECTED]
Subject: RE: help with commenting code..


How would I skip an index?? i.e.  I want to skip 0,1, and 6 ??

@f[6,2..$#f] ??


>>> Timothy Johnson <[EMAIL PROTECTED]> 09/12/02 09:47AM >>>

$#f stands for the last index of the array @f.  So 2..$#f means "from index
2 to the last index".  This means that the code is skipping $f[0] and $f[1].

-----Original Message-----
From: Mike Singleton [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, September 12, 2002 9:04 AM
To: [EMAIL PROTECTED] 
Subject: help with commenting code..



# grep each line for the declared variables
while (<IN>) {
         print "parsing $_";
         if ( /$JOBSTART|$TASKSUM|$TASKDET|$TASKEND|$ERROR|$JOBEND/i )
         {

# remove spaces and replace with commas
                 my @f = split /\s+/,$_,9;
                 
                  print OUT join (',', @f[2..$#f]) ;
---> What does this line (above) do?  I know it removes the first two
fields?

         } else {
                 print "skipped: '$_'\n";
         }
}

===
Mike Singleton 
Network Analyst
(253) 272-1916  x1259
(253) 405-1968 (cellular)
[EMAIL PROTECTED] 

DaVita Inc.
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED] 
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

DaVita Inc.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to