$var = "whatever"; sub foo { ... while ($var = ) { ... } ... } sub bar { ... foo(); ... code assuming $var is unmodified ... }