in reply to Re^3: Beware of global! And bless the local!
in thread Beware of global! And bless the local!

I use [Anonyblocks] primarily in unit test files to separate out tests of a feature or method where I need to instantiate a new object for a test sequence

This is also my primary use case. So I can have the same variable names repeated and don’t end up with $mech1 .. $mech10 or $json_116.

Replies are listed 'Best First'.
Re^5: Beware of global! And bless the local!
by stevieb (Canon) on Dec 12, 2019 at 17:37 UTC

    Exactly. Here's an example.

    I also use blocks in many of my test files where I'm performing tests against multiple functions or methods all within the same test file to make the sections more easily visible, and provide me with the ability to fold the sections in my IDE. Here's an example of that.