It sounds like the value of $filename is not what you thought it
might be in the subroutine.  Your could try print ing it out or
running the program under the perl debugger (perl -d progname).
Another thing to pay attention to is the return value of the
unlink call - it ought to be the number of files successfully
unlink'ed.  If you are only attempting to unlink a single $filename
then

   $rc = unlink($filename);
   if ( $rc != 1 ) {
       warn "Was unable to unlink $filename: $!, $^E";
   }

might provide some insight into the problem.

Peter Prymmer



                                                                                       
                                       
                      "Maissen Andreas                                                 
                                       
                      (KTXT 1)"                To:      "'[EMAIL PROTECTED]'" 
<[EMAIL PROTECTED]>                             
                      <andreas.maissen         cc:                                     
                                       
                      @csfs.com>                                                       
                                       
                                               Subject: unlink()  in a subroutine      
                                       
                      03/08/2002 03:55                                                 
                                       
                      AM                                                               
                                       
                                                                                       
                                       
                                                                                       
                                       



Hi

I'm trying to use the unlink(filename)-function inside a subroutine.
It doesn't work. If I use the function outside a sub it works.
could anybody help me in that case?

thanks

Maissen Andreas
CREDIT SUISSE FINANCIAL SERVICES
> Technology and Operations
CORBA Projects / KTXT 1
Postfach 600
CH-8070 Z�rich
Tel:  +41 1 332 75 21
Fax: +41 1 334 26 40
mailto:   [EMAIL PROTECTED]
Internet: http://www.csfs.com
Internet: http://www.credit-suisse.ch






Reply via email to