I'm really wracking my brain about this one though I bet there must be
some simple command I don't know which I'm missing.
I've got a file with a few lines:
1: Kevin 25 football cricket guitar
2: John 15 football karate
3: Fred 20 rugby painting
Via regular expressions I'm trying to do a few things here such as
counting how many hobbies people have and counting how many people have
the same hobby- its this last one in particular I can't figure out.
The only way I can think of is to split each line into a array (which in
turn is stored in a array) and then have dual loops checking the 1st
hobby from person 1 against the firsts of the others then against the
seconds of the other and all but...This really does require a mountain
of code and its proving very troublesome.
Is there some special command in ruby I'm missing which could help me to
do this quicker?
__END__
1: Kevin 25 football cricket guitar
2: John 15 football karate
3: Fred 20 rugby painting
Hope that helps.
James Edward Gray II
···
On Dec 15, 2006, at 6:12 PM, Just Maz wrote:
I've got a file with a few lines:
1: Kevin 25 football cricket guitar
2: John 15 football karate
3: Fred 20 rugby painting
Via regular expressions I'm trying to do a few things here such as
counting how many hobbies people have and counting how many people have
the same hobby- its this last one in particular I can't figure out.
I'm really wracking my brain about this one though I bet there must be
some simple command I don't know which I'm missing.
I've got a file with a few lines:
1: Kevin 25 football cricket guitar
2: John 15 football karate
3: Fred 20 rugby painting
Via regular expressions I'm trying to do a few things here such as
counting how many hobbies people have and counting how many people have
the same hobby- its this last one in particular I can't figure out.
The only way I can think of is to split each line into a array (which in
turn is stored in a array) and then have dual loops checking the 1st
hobby from person 1 against the firsts of the others then against the
seconds of the other and all but...This really does require a mountain
of code and its proving very troublesome.
Is there some special command in ruby I'm missing which could help me to
do this quicker?
I've got a file with a few lines:
1: Kevin 25 football cricket guitar
2: John 15 football karate
3: Fred 20 rugby painting
Via regular expressions I'm trying to do a few things here such as
counting how many hobbies people have and counting how many people have
the same hobby- its this last one in particular I can't figure out.