Some people like sigils. Some people don't. In Perl 6 you don't have to use them (as much).
my $x = 1; say $x;
my \y = 1; say y;
my @x = 1, 2; say @x;
my \y = @ = 1, 2; say y;
# also works with signatures
sub foo(\x) { say x }; foo(1);
However you can't use sigilless attributes
class ThisExplodes
{
has \.y; #doesnt work
has \y; #neiter does this
}
You can use this for example to distinguish normal variables from ones in closures, or lexicals from function arguments or whatever. Or maybe you event want to get rid of all sigils where possible.
The choice is yours.
Addendum
Sigilless variables do not create containers and are always immutable after initialization. They are therefore not a simple replacement with different visuals.
Edit: Fixed typo as hinted by
NetWallah
holli
You can lead your users to water, but alas, you cannot drown them.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.