If that's your whole program, I suspect you mean $ARGV[0] and $ARGV[1], which refer to the command-line arguments to your program, and not $1 and $2, which refer to the last two captures from a regular expression match. Making that change, your program doesn't give an error.