in reply to Re: Is space supposed to be ignored between a sigil and its variable name?
in thread Is space supposed to be ignored between a sigil and its variable name?
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Is space supposed to be ignored between a sigil and its variable name?
by almut (Canon) on Apr 18, 2009 at 22:01 UTC | |
by Bloodnok (Vicar) on Apr 19, 2009 at 00:17 UTC | |
by Porculus (Hermit) on Apr 19, 2009 at 14:06 UTC |