For fiddling with little bits of code, just use the debugger straight away:
swedish_chef> perl -demo
Loading DB routines from perl5db.pl version 1.32
Editor support available.
Enter h or `h h' for help, or `man perldebug' for more help.
DB<1> $string = "one two three four"
DB<2> x $string =~ m/(\w+)/g
Note that "my" variables don't work as expected, I think they get created in the Debug scope, and not in the interpreted scope. But otherwise, have fun in the sandbox.
Quantum Mechanics: The dreams stuff is made of