title: Ruby: undefined method 'unpack' when I'm trying to extract data between to regex markers in a hex file
body: <pre><code>#!/usr/bin/env ruby
  #this is the capture file from tcpdump for printer (9100) traffic
  filename = 'cap.pcl'
  capdata = {}
  
  File.open(filename,"r") {|capdata| capdata.read}
  
  #this is the regex that identifies the print job type as PCL or PJL
    if capdata.unpack("H*")[0] =~ /(1b45|1b25|1b26)/
      printjobtype = "PCL"
      print_good("Printjob of type PCL recieved")
  
    #trying to extract only the data between these 2 markers
      print_job_pcl = Array(pcdata.unpack("H*")[0].match(/((1b45|1b25|1b26).*(1b45|1b252d313233343558))/i)[0]).pack("H*")
    end
  ## error I'm receiving, 
  ## extractPrintJob.rb:8: undefined method `unpack' for #&lt;File:cap.pcl (closed)&gt; (NoMethodError)
  </code></pre>