Re: 2 off in array count and index

[email protected] (Rene Schickbauer) Mon, 22 Mar 2010 17:27:16 +0100
Newsgroups perl.beginners.cgi
Message-ID <[email protected]>
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.

These are always inserted by the filesystem in any directory for 
navigation purposes. These are (in principle) dynamically generated 
abbreviations for directory names.

Simply put
.. is needed when you need to go up one level higher in the file 
hierachie without parsing the current path, like "cd .."

. is mostly needed on the command line, when you want to execute a 
program from the current directory if its not in the search path, like 
"./myapp".

You might want to take a look at
<http://www.washington.edu/computing/unix/startdoc/directories.html>

LG
Rene