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

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