in reply to supress an error

Do something with $username and $admin.

Perl is warning you that you don't appear to be using those values, and that because of that something might be wrong.

Read perldoc -f our , perldoc vars and perldoc -f my to decide which one you need.

Note that the vars documentation has this note:

NOTE: The functionality provided by this pragma has been superseded by "our" declarations
The docs are your friend.

Update: I think I missed the obvious. Shouldn't it read as follows?

$username = $common::auth::user; $admin = $common::auth::admin;
Surely there is a nicer way of doing this? A small sub that returns the value you're after, perhaps?
package Foo; # Warning. Rubbish, untested code follows. sub get_admin { my $admin = "admin"; my $user = $ENV{"REMOTE_USER"}; return ($admin, $user); } package Bar; use Foo; @user_info = get_admin(); # Do stuff.

Cheers.

BazB

Replies are listed 'Best First'.
Re: Re: supress an error
by nlafferty (Scribe) on May 01, 2002 at 21:24 UTC
    I actually use both variables throughout the script. The error occurs because I use $common::auth::user and $common::auth::admin only once to define the value of $username and $admin.