in reply to The error says the value is uninitialized, but it works anyway
If perl was math we could say:
@colors - @drop = @colorsBut perl is perl so we have to say:
@colors = -@drop + @colorsPerl can do that, like this:
@colors = (miniature @drop program here) @colorsThe flow of information goes:
__<________________________<__
#4/ \#3
@colors = (miniature > program > here) @colors
#2\__<___________________<___/#1
The mini program goes inside map {} like:
@colors = map { my $x = join '|', @drop; /$x/ ? () : $_ } @colors;
Unrolled:
@colors =
map {
my $x = join '|', @drop; # make a regex
/$x/ ? () : $_ # simpler than it looks
}
@colors;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: The error says the value is uninitialized, but it works anyway
by haukex (Archbishop) on Aug 19, 2019 at 11:33 UTC | |
|
Re^2: The error says the value is uninitialized, but it works anyway
by AnomalousMonk (Archbishop) on Aug 19, 2019 at 15:15 UTC |