G'day thnksnw,
Welcome to the Monastery.
Having just posted a solution with three such anonymous blocks, I thought I'd share as another example. While not trying to take anything away from the examples already posted by others in this thread, my example is a fully functional script which may provide a little more insight as you're new to Perl.
I also use this method a lot when writing test scripts. Many individual tests within the one script can be very similar; using anonymous blocks means I don't have to continually think up new variable names, remember to reinitialise existing variables, or worry about accidentally redefining variables (e.g. my $var = ... used more than once in the same scope).
Have fun learning Perl.
— Ken
In reply to Re: Braces around a section of code
by kcott
in thread Braces around a section of code
by thnksnw
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |