- or download this
for my $name (@colors) {
no strict 'refs'; # allow symbol table manipulation
*$name = sub { "<FONT COLOR='$name'>@_</FONT>" };
}
- or download this
use strict;
use warnings;
...
print "green: ${\(green())}\n";
print "violet: ${\(violet())}\n";
- or download this
----- $name is constant inside sub ------
red: <FONT COLOR='red'></FONT>
...
red: <FONT COLOR='something wacky and wonderful'></FONT>
green: <FONT COLOR='something wacky and wonderful'></FONT>
violet: <FONT COLOR='something wacky and wonderful'></FONT>
- or download this
----- $name is constant inside sub ------
Use of uninitialized value in concatenation (.) or string at ...
...
red: <FONT COLOR='something wacky and wonderful'></FONT>
green: <FONT COLOR='something wacky and wonderful'></FONT>
violet: <FONT COLOR='something wacky and wonderful'></FONT>