Text or Number
Stas Bekman
stas at stason.org
Thu Mar 25 15:52:11 CST 2004
Scott Penrose wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Now I know I am being dumb here...
>
> How can I find out that $x is a single character of ord 00-ff vs a number:
>
> That is - "1" does not eq chr(1);
>
> The reason is that I get a log of people doing this
>
> $pp->set_byte(0, 1);
>
> And of course I set the value on the parallel port to ord("1").
> What I want to do is, if someone has given me a number - rather than a
> string, that I convert it to a character.
> chr(1);
>
> What is the safest way to do this ?
In addition to all the cool stuff Joshua mentioned, there is C API
Perl_looks_like_number, which you can probably easily glue with Inline::C. see
the perlapi manpage.
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas at stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
More information about the Melbourne-pm
mailing list