"Also - what other languages treat '0' as false?"
It would be horrible if "0" were treated as true, given that the integer 0 is false and Perl silently converts between strings and numbers.
What other languages? PHP does.
package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name
| [reply] [Watch: Dir/Any] [d/l] [select] |
Update: Post recomposed for better readability
> Also - what other languages treat "0" as false?
- JavaScript
Num yes Str no
>>> !! 0
false
>>> !! "0"
true
- Python
Num yes Str no
>>> not not 0
False
>>> not not "0"
True
- Ruby
Num no Str no
irb(main):002:0> !! 0
=> true
irb(main):003:0> !! "0"
(irb):3: warning: string literal in condition
=> true
- Perl
Num yes Str yes
DB<102> !! 0
=> ""
DB<103> !! "0"
=> ""
Cheers Rolf
( addicted to the Perl Programming Language)
| [reply] [Watch: Dir/Any] [d/l] [select] |
Hm, I think '-' can cause problems with getopts sometimes.
Oops! Starting filenames with '-' is just asking for trouble. Your life will be least painful if you start names with [a-z_], use only one '.', don't make them too long, and don't rely on case differences alone. If you find yourself wanting arbitrary filenames, either never pass them to other software, or consider using a database.
| [reply] [Watch: Dir/Any] [d/l] |
I remember a colleague who used to create files named "-i" in directories he wanted to protect. That way, when you did "rm *", the file list expanded into "rm -i ..." and you got prompted for each file. I'm not recommending it, but he liked it.
| [reply] [Watch: Dir/Any] |
| [reply] [Watch: Dir/Any] [d/l] [select] |