From: "David A. Black" Date: 2009-10-01T02:14:31+09:00 Subject: Re: Group by unique entries of a hash --1926193751-325468860-1254330854=:1496 Content-Type: MULTIPART/MIXED; BOUNDARY="1926193751-325468860-1254330854=:1496" This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --1926193751-325468860-1254330854=:1496 Content-Type: TEXT/PLAIN; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: 8BIT On Thu, 1 Oct 2009, Simon Krahnke wrote: > * Paul Smith (2009-09-29) schrieb: > >>> � �fields = data.split(",") >>> � �hash = fields[0] >>> � �ocrID = fields[1] > > BTW, you could write this as: > > hash, ocrID = *data.split(",") > > or > > hash, ocrID, *ignored = *data.split(",") > > if you want to ignore everything behind a second comma, or > > hash, ocrID = *data.split(",", 2) > > if you want to include a second comma and everything behind it into the > ocrID string. I don't think you need the * for any of them. This: hash, ocrID = data.split(',') should be fine for getting the first two values. David -- David A. Black, Director Ruby Power and Light, LLC (http://www.rubypal.com) Ruby/Rails training, consulting, mentoring, code review Book: The Well-Grounded Rubyist (http://www.manning.com/black2) --1926193751-325468860-1254330854=:1496-- --1926193751-325468860-1254330854=:1496--