CropCircle has asked for the wisdom of the Perl Monks concerning the following question:
Hello! I have no ideas how to fix this error, saw some similar problems, however didn`t find the answer.
Here is the code:
my $funct = sub($) { my $var = shift; my $var2 = $var =~ /red|green|blue/; $var2 = 'magenta' if ($var eq 'm'); return $var2; };
Thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Use of uninitialized value $var in pattern match (m//)
by Corion (Patriarch) on Apr 10, 2015 at 10:38 UTC | |
|
Re: Use of uninitialized value $var in pattern match (m//)
by Athanasius (Archbishop) on Apr 10, 2015 at 12:40 UTC | |
by CropCircle (Novice) on Apr 13, 2015 at 08:02 UTC | |
|
Re: Use of uninitialized value $var in pattern match (m//)
by hippo (Archbishop) on Apr 10, 2015 at 10:37 UTC | |
by Laurent_R (Canon) on Apr 10, 2015 at 17:10 UTC |