3 ms·
Thank you for clarifying. Last example looks nice and make visual sense :) Could you point me somewhere or give a name for $^a/$^b? Want to find out how does i
by hippich 15y ago
Thank you for clarifying. Last example looks nice and make visual sense :)
Could you point me somewhere or give a name for $^a/$^b? Want to find out how does it work :)
- draegtun 15y agoGenerically 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