A programmer’s approach of solving counting problem

Today I got mail from Locus team, it was invitation to a hackathon named Hack-a-week. It immediately caught my attention as it had something unusual. It had long list of email address in the ‘to’ field.

I got curious about number of email address, I immediately copied all the email address, opened irb(Interactive Ruby Shell) and typed these two comands.

emails = “<all copied emails>”
emails.split(‘,’).count

and the result was 486, They had just handed me 486 email addresses, I could spam in future. I quickly replied them, “thank you for those 486 emails”.

I started thinking, how would have non-programmer counted that!
After pondering a few minutes, I realised that: had I pasted all those email in any spreedsheet, it would have made 486 rows.

I felt stupid for rushing into irb.
Only satisfactory thing about that stupidity is that writing and executing that piece of code took less time than opening spreadsheet.