Dang, you perl guys thought of everything! Thanks! jlc ________________________________________ From: Chas Owens [EMAIL PROTECTED] Sent: Wednesday, July 04, 2007 3:21 PM To: Joseph L. Casale Cc: Tom Phoenix; beginners@perl.org Subject: Re: File::Spec->splitpath
On 7/4/07, Joseph L. Casale <[EMAIL PROTECTED]> wrote: > Just found that. I suppose I could use it, then get the size of the array and > use the last indices? Is there a cleaner way to do it? > Thanks! > jlc snip You can use negative indices to count from the end of the array: my @a = (1, 2, 3, 4, 5, 6); die unless $a[-1] == $a[5] == 6; die unless $a[-2] == $a[4] == 5; die unless $a[-3] == $a[3] == 4; die unless $a[-4] == $a[2] == 3; die unless $a[-5] == $a[1] == 2; die unless $a[-6] == $a[0] == 1; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/