develooper Front page | perl.beginners | Postings from March 2002

RE: Assigning chunks into variables - Please ignore previous email

Thread Next
From:
Ho, Tony
Date:
March 21, 2002 13:52
Subject:
RE: Assigning chunks into variables - Please ignore previous email
Message ID:
17BB19F31428D411B3CC0090279A312802C98782@lon-exch2.kenan.com
Hi guys
I managed to use the "split" and "join" functions to achieve what I wanted.
Many thanks for those who started thinking about a possible approach.
Tony 

-----Original Message-----
From: Ho, Tony 
Sent: 21 March 2002 20:37
To: 'beginners@perl.org'
Subject: Assigning chunks into variables


Hi guys
I was wondering if you could help me.
 
I have the following string:
 
2010:abc:def:ghi
 
If I go through this string and find the first colon (:), I want to assign
everything before that colon into variable1
I would like to assign the rest of the string after the first colon into
variable2.
 
Therefore,
variable1 = 2010
variable2 = abc:def:ghi
 
I was wondering how I can approach this ?
 
I would be most grateful
Thanks in advance
Tony


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About