[% setvar title Rename @ARGV to @ARGS %]

This file is part of the Perl 6 Archive

Note: these documents may be out of date. Do not use as reference!

To see what is currently happening visit http://www.perl6.org/


Rename @ARGV to @ARGS


  Maintainer: Nathan Wiger <nate@wiger.org>
  Date: 11 Aug 2000
  Last Modified: 11 Sep 2000
  Mailing List: perl6-language@perl.org
  Number: 94
  Version: 2
  Status: Retracted


Perl isn't C. Time to get over it. :-)


Beginner-friendly, at the expense of all the experts. Bad Idea.


@ARGV is Perl's version of something like C's argv/argc. However, I would argue its naming is bad, because:

   1. It isn't used like and doesn't behave like C's argv/argc
      in many circumstances

   2. There's no $ARGC to go with it

   3. It's not a word or anything close to a word

   4. Perl isn't C (thank heavens!)

   5. @ARGV makes little sense to people (like me) from a sh/ksh

@ARGS is a better choice for several reasons:

   1. It's closer to a word and so is faster to read [1]

   2. It's easier to explain and remember "Your command-line
      args are contained in @ARGS"

   3. When you say "$var = $ARGS[2]" it's easier to glance
      at and tell what you're getting quickly

   4. It makes it more consistent with other word-like
      Perl vars like $VERSION.

   5. There's no expectation that it works like or should
      be used like C's argv/argc

I don't feel this is changing something just for the sake of changing something. I think it actually helps clarify a key difference between Perl and C. However, feel free to disagree with me. Be nice. ;-)


Change @ARGV to @ARGS. Make sure that the translator changes any code references in a person's script too. Make sure shift works on @ARGS, etc, etc.


[1] This is true. I did a lot of work in cognition and artifical intelligence in college. Your brain reads words and legal word-like constructs about 3 times faster than non-words, even if there's only a one or two character difference. For example, you'd read "fleggies" much faster than "fleggitg". Kind of neat, eh?