Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cgi string functions 1

Status
Not open for further replies.

richy

Programmer
Aug 10, 2000
1
GB
I'm working on some code in Perl, but require the same function as right or substring in vb which takes a certain amount of characters from the right of the string but can't find it anywhere. Can anybody help?
 
Try 'substr'. It will pick any number of chars from anywhere in the string going forward or backward.

For more detail, do,
perldoc -f substr


HTH


keep the rudder amid ship and beware the odd typo
 
If you want to take x characters from the right end of a string use a negative offset, like this:
Code:
$right10 = substr($string, -10);
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top