in reply to Pls explain this syntax

Much of this can be understood by checking the relevant documentation.

1) While you could declare these variables to be package variables (using our, or by using their full names, you don't really gain any benefit over declaring them as lexical variables with my.

IMHO, the main reason for using my is to help develop good habits. When making a module, you might want to declare variables that are only available inside the module. You would use my for this. The only reason to use our would be if you wanted the variables to be accessible outside the module. Using my by default gets you in the habit of reducing the coupling between different parts of you code, unless you specifically choose otherwise.

2) The dirname in this case is a function call (see File::Basename). This is not to be confused with $dirname which is a scalar variable. dirname has no more in common with $dirname than @dirname does. Using different names would have made this example a bit clearer.

3) Yes.

4) See the documentation for s/// (in Regexp Quote Like Operators) where you will find that the substitution operation (and the match operator m// both support alternate delimiters. In this case, the delimiter is #.

G. Wade