I'm not sure how to achieve this.
The How depends mostly on the Why - and you have not explained that. This is probably an XY Problem.
One solution is a closure.
#!/usr/bin/env perl use strict; use warnings; my $x; sub greeting { my $str = 'Hello ' . $x; print $str . "\n"; } $x = 'Kevin'; greeting (); $x = 'chickenman'; greeting ();
🦛
In reply to Re: Evaluate variable while using
by hippo
in thread Evaluate variable while using
by chickenman
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |