[Za-pm] Re: perldoc

Nick Cleaton nick at cleaton.net
Fri Jun 6 03:15:56 CDT 2003


On Fri, Jun 06, 2003 at 07:38:57AM +0200, Sean Carte wrote:
> On Thu, 2003-06-05 at 16:08, Nick Cleaton wrote:
> > On Thu, Jun 05, 2003 at 03:30:14PM +0200, Sean Carte wrote:
> > > > 
> > > >   exec 'perldoc', $0 if "@ARGV" eq '--help';
> > > 
> > > Nice. But I'll keep my warning prevention:
> > > 
> > > exec 'perldoc', $0 if ( $ARGV[0] and ( $ARGV[0] eq '--help' ) );
> > 
> > Try mine - no warning.
> 
> I still get a warning when I run the script:
> 
> Use of uninitialized value in string eq at test_script.pl line 24.

That's strange, I don't get that.

> I think the critical difference is in my first line:
> 
> #!/usr/bin/perl -w
> 
> I always enable warnings (and use strict).

I always do that too.

I get no warnings with this test script:

<snip>
#!/usr/bin/perl -w
use strict;

=head1 NAME

test - a test script

=head1 SYNOPSIS

foo

=cut

exec 'perldoc', $0 if "@ARGV" eq '--help';

print "hello, world ($])\n";

</snip>

What perl version are you using ?

Could you post your entire test script, and the shell command
you're using to run it when you see a warning ?

--
Nick



More information about the Za-pm mailing list