in reply to Getopt::Std and simple options

Your code does not really match your output. Any way, < is redirect, and does not set -v.

use strict; use Getopt::Std; our $opt_v; getopt('v'); print $opt_v;

When you run it as perl -w blah.pl -v abc, it prints abc as expected.

Replies are listed 'Best First'.
Re^2: Getopt::Std and simple options
by Dizzley (Novice) on Sep 06, 2005 at 05:44 UTC
    The redirect is intentional, I included it in the example call in case that was affecting the outcome.

    I am trying to set a verbose flag '-v' with no value; that's what I meant by "simple options". The real answer was to use getopts() rather than getopt(). The code matched the output: only the script name was changed to protect the innocent. :^)

    Thanks for helping anyway.

    ~Diz