Shawn H Corey wrote:
> Steve Bertrand wrote:
>> my $month = $ARGV[0] if $ARGV[0];
> 
> $ cat myscript.pl
> #!/usr/bin/perl
> 
> use strict;
> use warnings;
> 
> my $month = $ARGV[0] if $ARGV[0];
> print "$month\n";
> $ ./myscript.pl
> Use of uninitialized value $month in concatenation (.) or string at
> ./myscript.pl line 7.
> 
> 
> 
> Try:
> my $month = '';
> $month = $ARGV[0] if $ARGV[0];

aha! It was the *declaration* part of the critic complaint that I read
over. For some reason I was thinking 'assignment'. Perhaps I should read
next time.

Thanks!

Steve

ps. again, far better arg handler is in order ;)

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to