in reply to Re: reset function (never)
in thread reset function

Once in a while I repeat saying something like

"Perl doesn't stop to surprise me!"

And I always hope the intervals between these moments will get bigger...

But now... oh man ... this reset builtin is really scary!

DB<132> @x=(4,2);$x=42; $y=0; while ($y++<3) { $x=$y; print "$x -" ; reset('x') if $y>1 ; print " $x : @x\n"; } 1 - 1 : 4 2 2 - : 3 - :

IMHO it doesn't "reset" at all, it just deletes all variables of the glob *x without deleting the glob.

Only delete $main::{'x'} is more radical...

o_O WTF !?!

Cheers Rolf

( addicted to the Perl Programming Language)

update

Me thinks this must be a relict of one-liner hacking. Anything else is just to dangerous..

Replies are listed 'Best First'.
Re^3: reset function (never)
by boftx (Deacon) on Nov 21, 2013 at 02:47 UTC

    WOW!! WTF, indeed! I can understand something that would reset a match, but variables that start with a given letter? Can someone provide a use-case for this that makes sense?

    It helps to remember that the primary goal is to drain the swamp even when you are hip-deep in alligators.