use the length() function

$length = length($string);

Stephen Redding

BT Ignite Solutions
Telephone - 0113 237 3393
Fax - 0113 244 1413
Email - [EMAIL PROTECTED]
http://www.technet.bt.com/sit/public/


British Telecommunications plc
Registered office: 81 Newgate Street London EC1A 7AJ
Registered in England no. 1800000
This electronic message contains information from British Telecommunications
plc which may be privileged or  confidential. The information is intended to
be for the use of the individual(s) or entity named above. If you  are not
the intended recipient be aware that any disclosure, copying, distribution
or use of the contents of  this information is prohibited. If you have
received this electronic message in error, please notify us by  telephone or
email (to the numbers or address above) immediately.



-----Original Message-----
From: David vd Geer Inhuur tbv IPlib
[mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 07, 2002 14:04
To: [EMAIL PROTECTED]
Subject: How to get number of characters from var?



Hi,

I have a question about determine how many charactars contain a var. 
Does anyone know, there will probably be a simple command, but I can't find
it.

Assuming $_ =
/hello/this/will/have/to/be/IMPORTANT/ONLY/AND/CAN/BE/LONG/features.txt

        $dir = substr("$_", 0, -13);  ## Remove features.txt
        $link = substr("$dir", 27);  ## Remove the not used and already
defined $base
        @href = split(/\//, $link);  ## put this in an array
        $lineteller = ( scalar(@href) -1 );  ## To determine the last word
        $href = "$href[${lineteller}]"; ## and make $href this last one
        
        $nhref = ???($href);    ?? Determine number of characters
        $header = substr("$link", 0, -${nhref});  ## Use it to def $header
without $href
        
So what I need out of $_ :

 $dir = "/hello/this/will/have/to/be/IMPORTANT/ONLY/AND/CAN/BE/LONG";
 $link = "/IMPORTANT/ONLY/AND/CAN/BE/LONG";
 $href = "LONG";
 $header = "/IMPORTANT/ONLY/AND/CAN/BE/";
 
I know there is a faster way to get the last value of an aray, but I don't
know
exactly how anymore (help is welcome). The most important now is, how do I
get
the number of charactars out of $href ??

Thanks for your help in adance !!

Regs David

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to