[sf-perl] Unusual Perl "feature"

Earl Ruby earl at ruby.org
Fri Feb 15 15:58:11 PST 2013


I made a typo and found a new feature.

I have no idea what this feature is for:

> perl -e 'use strict; my $name = - "NAME"; print "$name\n"; print "Perl prepended a minus sign to my string\n" if $name eq "-NAME";'
-NAME
Perl prepended a minus sign to my string

Interesting behavior. Can anyone give me an example of what is this used for?

--
Earl Ruby
http://earlruby.org/
http://www.linkedin.com/in/earlruby
@earlruby


More information about the SanFrancisco-pm mailing list