Venugopal P <[EMAIL PROTECTED]> wrote:

> Once you close the file, memory for the file handle will be
> deallocated.
> You can unlink file using the original file name.
> unlink ("abc");

This doesn't answer my question.  I wanted to know if it is
possible to remove a file using the FH name, not the variable name
referencing it.  Please see my original post below.

Thanks again,

JW

 
> -----Original Message-----
> From: Jeff Westman [mailto:[EMAIL PROTECTED]
> Sent: Thursday, April 01, 2004 2:02 AM
> To: perl_help
> Subject: Is this possible? (file handles)
> 
> 
> Hi,
> 
> I want to remove an empty file using the file handle and not a
> variable name or literal name referencing it.  Something like
> this:
> 
>      1  #!/bin/perl 
>      2  use warnings;
>      3  use strict;
>      4  no strict 'subs';
>      5
>      6  open(F, "> abc") or die "cant create file: $!";
>      7  close(F) or die "cant close file: $!";
>      8
>      9  unlink(\*F) if -z (F);
> 
> But, in this case, I get an error:
> 
> $ runme.pl
> -z on closed filehandle F at ./x line 9.
> 
> 
> TIA,
> 
> Jeff


__________________________________
Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway 
http://promotions.yahoo.com/design_giveaway/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to