Hi,

I'm trying to be a good boy and use strict and warnings ..

The more I do, the more I feel I'm wasting so much time and should become productive, my code looks full of 'my', I could understand the requirement inside a sub routing but in the main code it gives me the willies. My DBI Perl is even more of a headache ;-((

Anyway, enough whining, now I've going through code that is working and thought I'd see the big difference if I change it to use warnings and strict and this little routing gives me 'Use of uninitialized value in pattern match (m//) at ./getopt.pl line 14.'

Line 14 is the while line..

I've tried all sorts of stuff with defined but keep getting syntax errors. I've tried perldoc warnings and perldoc perllexwarn .. In any case, unless I'm really missing something, I can't see what could be problematic with the while statement below, of course this shows my ignorance but as I've decided to use warnings and strict, I want to do it right..

How would a pedant code the following to avoid this warning.. Your answers will help me in the future.

#if ($#ARGV >= 0) { # What I've tried
        while ($_ = $ARGV[0], /^-/) {
                shift;
                last if /^--$/;
                if (/^-d(.*)/) { $debug++ }
                elsif (/^-v(.*)/) { $verbose++ }
                else { print "$_ unknown option\n";
                        Usage;
                }
        }
#}

Thanks in advance, I really want to put, Perl with warnings and strict in my CV ;-))))))))))))

Jerry


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to