> 
> unlink <*.bak>;
> 
> how I am supposed to specify directory above?
> 
> for example I have to apply above unlink command to delete all backup
files in the Specified directory.
> 
> $dir = /home/path/to/dir
> 
> is it right?
> 
> unlink <$dir/*.bak>;
> 
> ??
> 
> Any ideas?
> 

The <> operator has two purposes one as a IO handle readline function
the other as a file globber.  You are using it in the second case. You
can read more in:

perldoc perlop

Specifically in the section on the <> operator and file globbing, which
is part of the "I/O Operators" subsection.

Essentially it recommends you use an explicit 'glob' in this case, so
something like:

unlink glob("$dir/*.bak");

Should do the trick.  Don't forget to check for success, yada yada yada...

perldoc -f glob

http://danconia.org



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to