in reply to strange comma
This is a very common, and imho, proper practice.
The extra comma (ie. separator) signifies that something may be coming next. If nothing comes next, perl ignores it.
However, with decent layout techniques, it is easy to identify where the original coder meant to allow for future manual or automated growth by including the separator within the code. I *always* include the extra separator: eg
my $href = { a => 'apple', b => 'bannana', c => 'coconut', };
I find this especially useful when designing an API that can grow at any time:
func({ this => 'that', these => 'those', ours => 'theirs', when => 'now', });
Having the habit of always writing the trailing comma (separator) means that I'll *never* have to troubleshoot an issue where one isn't present.
stevieb
|
|---|