Re: 2 off in array count and index

2010-03-22 Thread Jay Savage
On Tue, Mar 16, 2010 at 11:47 AM, jbl wrote: > I am reading a directory and creating an array of .png file names. I > know for a fact that there are 1025 png files in the folder > With $count = @files I get 1027 > With $last = $#files I get 1026 > $files [0] = . > $files[1] = .. > I have heard of

Re: 2 off in array count and index

2010-03-22 Thread Rene Schickbauer
jbl wrote: I am reading a directory and creating an array of .png file names. I know for a fact that there are 1025 png files in the folder With $count = @files I get 1027 With $last = $#files I get 1026 $files [0] = . $files[1] = .. "." is the current directory, ".." is the parent directory.

Re: 2 off in array count and index

2010-03-17 Thread Robert Roggenbuck
jbl schrieb: I am reading a directory and creating an array of .png file names. I know for a fact that there are 1025 png files in the folder [snip] my @files = grep !/^\.png/, readdir FILENAMES; Try it better positive: my @files = grep /\.png$/, readdir FILENAMES; ;-) Greetings Rober

2 off in array count and index

2010-03-17 Thread jbl
I am reading a directory and creating an array of .png file names. I know for a fact that there are 1025 png files in the folder With $count = @files I get 1027 With $last = $#files I get 1026 $files [0] = . $files[1] = .. I have heard of being one off by not taking into account the difference in n