#!/usr/bin/perl -w use strict; sub zen { my $coderef = shift; # the code ref is a &$coderef; # Find the inner meaning[s] # &$coderef; }; my $petition = "How can I put a variable that is only visible to zen from within this anon code block?"; zen do { my $speech = $petition; print $speech,$/; sub { $_ = shift; $speech = $speech =~ /^How/ ? $_ : "Mu."; print $speech,$/; } }, "There is do and there is not do.";