morgon has asked for the wisdom of the Perl Monks concerning the following question:

Did you know that there is a "reset" in Perl (http://perldoc.perl.org/functions/reset.html)?

I have been using Perl now for 10+ years but somehow I've never come across that...

Is this a leftover from the days when there were no lexial variables in Perl?

Can someone illustrate a legitimate use of this function - a case where you would really need such a beast?

I hope some day I can turn this knowledge into beers by luring unexpecting hackers into a bet they cannot win :-)

Replies are listed 'Best First'.
Re: reset builtin
by ikegami (Patriarch) on Apr 06, 2009 at 22:30 UTC
    perlop has the following example
    while (<>) { if (?^$?) { # blank line between header and body ... } } continue { reset if eof; # clear ?? status for next file }
      Ok fair enough - I'll re-phrase my question:

      Can you show me a legitimate use of "reset 'X'" to reset all vars starting with X?

        No.

        There are uses for clearing an entire package (including subs), but it doesn't look like reset does that from the docs.