thanks!
> > hi,
> >
[quoted text clipped - 21 lines]
>
> String[] tokens="name1 city1 email1 email2 email3".split(" ");
>> ($name,$city,$email)= split /\s+/,$line,3;
>>
>> can store the names,cities and emails in separate strings.
>>
>> In java how can this be done?
...
> With Java 1.4 and above you could use the split function of the String
> class.
>
> String[] tokens="name1 city1 email1 email2 email3".split(" ");
That's not quite the same thing. Note in the Perl example, he's asked for
it to be split into 3 strings, so he will get these three strings:
"name1"
"city1"
"email1 email2 email3"
Also, probably best to allow for multiple spaces, like in his Perl example,
so what he probably should use is split("\\s+",3).

Signature
--Tim Smith
Jussi Piitulainen - 04 Jun 2006 15:43 GMT
...
>> String[] tokens="name1 city1 email1 email2 email3".split(" ");
>
[quoted text clipped - 8 lines]
> Also, probably best to allow for multiple spaces, like in his Perl
> example, so what he probably should use is split("\\s+",3).
That's hardly realistic, if "name1" stands for a real name: some
people have spaces in their names - you and I, for example - and I
thin some cities do, too.
Just wondering what the real problem is.
Mani - 04 Jun 2006 17:38 GMT
I am not developing any particular application.
I am just learning how certain things in perl can be done using Java.
Just i came across the following link,
http://www.cs.mcgill.ca/~abatko/computers/programming/perl/howto/hash/
where they have used,
Function to build a hash of hashes
and
Function to build a hash of hashes of hashes
I am just interested and want to know,how it can be done in java.
Thats the intent of my posting...
-Mani
> ...
> >> String[] tokens="name1 city1 email1 email2 email3".split(" ");
[quoted text clipped - 15 lines]
>
> Just wondering what the real problem is.
Jussi Piitulainen - 04 Jun 2006 19:32 GMT
> I am not developing any particular application.
> I am just learning how certain things in perl can be done using Java.
...
> Thats the intent of my posting...
That's ok then.