[ Create a new account ]
sub is_numeric { ($_[0] & ~ $_[0]) eq "0"; }
I found this gem when I was reading this thread about DBI::PurePerl.
DB<4> p ~ 100 4294967195 DB<5> p ~ '100' XXX
where XXX some chars from second half of ASCII table.
With numeric argument '~' acts as usual bitwise negation operator. With string argument it acts like
join '', map chr((~ord) & 255), split //, $arg
Ilya Martynov (http://martynov.org/ [martynov.org])
Get More Comments
Reply
Explain this then! (Score:1)
1
DB<9> p is_numeric('1.34')
DB<10>
Re:Explain this then! (Score:2, Insightful)
DB<4> p ~ 100
4294967195
DB<5> p ~ '100'
XXX
where XXX some chars from second half of ASCII table.
With numeric argument '~' acts as usual bitwise negation operator. With string argument it acts like
join '', map chr((~ord) & 255), split //, $arg
Ilya Martynov (http://martynov.org/ [martynov.org])