# Getopt/long and ARGV

**URL:** <https://www.ruby-forum.com/t/getopt-long-and-argv/75673>\
**Category:** Ruby\
**Created:** [November 12, 2006, 6:23am UTC](https://www.ruby-forum.com/t/getopt-long-and-argv/75673 "2006-11-12T06:23:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joel\_VanderWerf](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e19b73/32.png) [@Joel\_VanderWerf](https://www.ruby-forum.com/u/Joel_VanderWerf)\
**Post date:** [November 12, 2006, 6:23am UTC](https://www.ruby-forum.com/t/getopt-long-and-argv/75673/1 "2006-11-12T06:23:19Z")

</div>

Why does getopts delete the option _arguments_ but not the options  
themselves from ARGV:

$ cat opt.rb  
require “getopt/long”  
include Getopt  
opts = Long.getopts(  
["–plot", BOOLEAN],  
["–foo", OPTIONAL]  
)  
p ARGV

$ ruby opt.rb --plot --foo 8  
["–plot", “–foo”]

Wouldn’t it be better for #getopts to delete all members of ARGV that it  
recognizes? Then you can use ARGF for the remaining file names.
