LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-03-2004, 12:01 AM   #1
Bassam
Member
 
Registered: Mar 2003
Location: Malaysia
Posts: 63

Rep: Reputation: 15
Question How to separate a string in Perl


Hello Guys,
I have a string consiste of 4 alphanumeric, so is there a function in Perl that helps me to separate this string into two strings?

for example:

3fc9 ---------> 3f and c9


Thanks for help
Bassam
 
Old 06-03-2004, 01:33 AM   #2
micxz
Senior Member
 
Registered: Sep 2002
Location: CA
Distribution: openSuSE, Cent OS, Slackware
Posts: 1,131

Rep: Reputation: 75
$a=3fc9;
$first_half_of_a=substr($a, 0, 2);
$other_half_of_a=substr($a, 2, 2);
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Perl string comparisons Xris718 Programming 5 04-03-2005 10:43 AM
Perl String comparison Xris718 Linux - General 5 04-01-2005 01:59 PM
Parse a perl string djgerbavore Programming 3 10-31-2004 07:23 AM
extracting first n characters of a string in perl ananthbv Programming 4 09-14-2004 07:25 AM
loop through string with perl lfur Programming 2 07-03-2004 08:05 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:19 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration