On 3/11/06, Joel Gwynn <[EMAIL PROTECTED]> wrote:
> I know I've done this before, but I'm not sure what I'm doing
> differently today.  I'm trying to capture a simple command-line option
> like so:
>
> my $debug = 0;
>
> if(grep(/--debug=(\d+)/, @ARGV)){
>     $debug = $1;
>     print "debug: $debug\n"; # Error here
> }
>
> But I keep getting "Use of uninitialized value in concatenation (.) or
> string" when I try to do something with the debug variable.  How can
> $1 not be initialized?  If it's matching, then it should have a value,
> no?

That looks like a bug to me.  But you can work around it as follows:

while(grep(/--debug=(\d+)/, @ARGV)){
    $debug = $1;
    print "debug: $debug\n";
    last;
}

Cheers,
Ben
 
_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to