[sf-perl] Unusual Perl "feature"

Uri Guttman uri at stemsystems.com
Tue Feb 19 09:39:20 PST 2013

someone asked why the prefix - was allowed in => word quoting. there is 
a strong reason and history for this. it comes from perl/tk (even back 
in perl4 days before the => existed). keys in perl/tk are all prefixed 
by - as is the case with some other apis. not as common anymore but it 
was common enough that prefix - was just a way to put a leading - on a 
string. - 'foo' is the same as '-foo'. and when => came into perl and it 
autoquoted barewords on its left side, it also allowed those words to 
have a prefix -. so you can always do this:

	-foo	=> 1,
	-bar	=> 3,

same as quoting the left sides.


More information about the SanFrancisco-pm mailing list