4 ms·
Generically these are called twigils, ie. it has a second sigil. This second sigil describes what it does differently to single sigil variable. For eg. an ast
by draegtun 15y ago
Generically these are called twigils, ie. it has a second sigil.
This second sigil describes what it does differently to single sigil variable. For eg. an asterisk denotes a contextual twigil variable...
$*IN # equiv to STDIN in perl5
$*OUT # and STDOUT
The ^ twigils denote placeholder variables. In Perl5 there is already implicily defined package variables called $a & $b so that you can do...
sort { $a <=> $b } @array;
In Perl 6 these are replaced with the ^ twigils so you can do...
sort { $^a <=> $^b }, @array;
or even...
sort { $^x <=> $^y }, @array;
ref: http://perlgeek.de/en/article/5-to-6#post_15 http://perlgeek.de/en/article/5-to-6#post_15 & http://perlcabal.org/syn/S06.html#Placeholder_variables http://perlcabal.org/syn/S06.html#Placeholder_variables
BTW, Perl6 Placeholders have been ported back to Perl5 - https://metacpan.org/module/Perl6::Placeholders https://metacpan.org/module/Perl6::Placeholders