title: How do I print the line number of the file I am working with via ARGV?
body: <p>I'm currently opening a file taken at runtime via ARGV:</p>
  
  <pre><code>File.open(ARGV[0]) do |f|
    f.each_line do |line|
  </code></pre>
  
  <p>Once a match is found I print output to the user. </p>
  
  <pre><code>if line.match(/(strcpy)/i)
     puts "[!] strcpy does not check for buffer overflows when copying to destination."
     puts "[!] Consider using strncpy or strlcpy (warning, strncpy is easily misused)."
     puts " #{line}"
  end
  </code></pre>
  
  <p>I want to know how to print out the line number for the matching line in the (ARGV[0]) file. </p>
  
  <p>Using <code>print __LINE__</code> shows the line number from the Ruby script. I've tried many different variations of <code>print __LINE__</code> with different string interpolations of <code>#{line}</code> with no success. Is there a way I can print out the line number from the file?</p>