Ruby Anagrams Checker I am quite new to Ruby, coming from a JavaScript background. I wrote this simple Ruby script that finds whether two strings are anagrams or not. 

To run it: ruby ruby_anagrams.rb 'script1' 'script2'

I am looking for comments and a code review on my script. Can I do anything better? Is this good Rubyism?

# removing whitespace (in case of multi-word anagrams), converting to lowercase and getting
# array representations:
string_1_arr = ARGV[0].gsub(/\s+/, "").downcase.split("")
string_2_arr = ARGV[1].gsub(/\s+/, "").downcase.split("")

if string_1_arr.size != string_2_arr.size
  puts "Not anagrams"
  exit
end

string_1_arr.each do |c|
  print c, " ",string_2_arr, "\n" # debug statement, but left here 'cuz the output looks cool

  # just delete would delete all occurences of the same letter, e.g. "food" would become
  # "fd" if we delete 'o', which is obviously wrong. Have to use delete_at(index) instead
  if i = string_2_arr.index(c)
    string_2_arr.delete_at i 
  else
    puts "Not anagrams"
    exit
  end
end

puts "Anagrams!"
You should abstract the code to avoid duplication. Also, use a counter with O(n) performance:

module Enumerable # or require 'facets/enumerable/frequency'
  def frequency
    each_with_object(Hash.new(0)) { |item, counter| counter[item] += 1 }  
  end
end

def anagrams?(s1, s2)
  frequency = proc { |s| s.gsub(/\s+/, "").downcase.chars.frequency }
  frequency.(s1) == frequency.(s2)
end

if ARGV.size != 2
  $stderr.puts("Need two words")
  exit(1)
elsif anagrams?(*ARGV)
  puts("Anagrams")
else
  puts("Not anagrams")
end