You cant delete the typeglob while a reference to it still exists (fro +m $a or $b). You can however make it undefined, (freeing up any IO ha +ndles etc attached to it) with the following:
Thanks for giving me a solution, I have understood, but I have one more question, Let us consider the below code,
open $a, "/etc/passwd" or die "can't open /etc/passwd: $!\n"; { local $/ = undef; $userdetails = <$a>; print ">>",$userdetails,"<<\n"; } close($a); # this closes the filehandle print "A>",$a ,"<\n"; # this prints a glob # .... (assume that some lines of code lies here) # .. ######################################################### # in some other part of the program, How do I check whether # the filehandle associated with the handle is still open? # I have done it this way, if(defined fileno($a)), # because fileno(filehandle) will return undef if there is # no filehandle associated with it. # Is any other ways exist to check the above problem?. #########################################################

In reply to Re^4: How to remove the actual glob from a glob reference by targetsmart
in thread How to remove the actual glob from a glob reference by targetsmart

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.