Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

(jcwren) Re: Counting number of characters in a string

by jcwren (Prior)
on Mar 13, 2001 at 02:42 UTC ( #64001=note: print w/ replies, xml ) Need Help??


in reply to Counting number of characters in a string

#!/usr/local/bin/perl -w use strict; { my $string = "Oh please, good sir program, what is my length?"; printf ("The length is %d characters\n", howlong ($string)); use Inline C => <<'END_OF_C_CODE'; #include <string.h> int howlong(char *s) { return strlen (s); } END_OF_C_CODE }
--Chris

e-mail jcwren


Comment on (jcwren) Re: Counting number of characters in a string
Download Code
Re: (jcwren) Re: Counting number of characters in a string
by tye (Cardinal) on Mar 13, 2001 at 02:48 UTC

    What do you have against nul bytes? (:

            - tye (but my friends call me "Tye")
Re^2: Counting number of characters in a string
by Anonymous Monk on Jun 21, 2010 at 07:13 UTC

    It didn't working

    use strict; { my $string = "Oh please, good sir program, what is my length?"; printf ("The length is %d characters\n", howlong ($string)); use Inline C => <<'END_OF_C_CODE'; #include <string.h> int howlong(char *s) { return strlen (s); } END_OF_C_CODE }

      Works fine on Linux. I imagine you're missing either Inline::C or string.h and the associated library.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://64001]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (7)
As of 2014-07-13 21:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (252 votes), past polls