Keep It Simple, Stupid | |
PerlMonks |
Re^12: Immediately writing the results of search-and-replaceby afoken (Chancellor) |
on Aug 12, 2022 at 07:12 UTC ( [id://11146114]=note: print w/replies, xml ) | Need Help?? |
my ($old, $new, $reset) = map "\e[${_}m", 91, 92, 0; Left-hand side: Three variables, $old, $new, $reset. Right-hand side: A map expression iterating over the three values 91, 92, and 0. map evaluates the expression "\e[${_}m" for each of the three values, resulting in the list "\e[91m", "\e[92m", "\e[0m". Finally, the three element RHS list is assigned to the LHS list of variables. The values are ANSI terminal escape sequences for setting text attributes, see https://en.wikipedia.org/wiki/ANSI_escape_code#SGR. 91 selects bright red foreground, 92 selects bright green foreground, 0 resets back to defaults. Alexander
-- Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
In Section
Seekers of Perl Wisdom
|
|