Unless you 'wanted' to interpolate
my $bar = "$ foo and $cake";
Or a more likely example
my $bar = "$ $total_foo_dollars";
I had no idea that spaces in quotes could be abused this way and it just feels so wrong.
How about
my $foo = ['a', 'b', 'c']; my $bar = "$ foo -> [2]";
vs
my $foo = ['a', 'b', 'c']; my $bar = "$foo->[2]";
Before reading this thread I would have a clear answer for what the result of $bar would be in each case. After reading this thread I had a less clear different answer. And after actually testing the code I can see now that I was wrong in all my assumptions. Now I've got a nagging feeling that I should review all my code for unintended quoting results.
In reply to Re^2: Is space supposed to be ignored between a sigil and its variable name?
by ruzam
in thread Is space supposed to be ignored between a sigil and its variable name?
by boom
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |