Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hiya,

When i try to run the code below, i recieve this error message: Use of uninitialized value in concatenation (.) at ./addvirtuser.pl line 90.
if(system('/usr/local/bin/AddVirtUser' => "tpasswd=$password", => $domain, => $username, => $fullname, => 5, => '0 0 0', )){ #################################################### ## ## ACCOUNT FAILURE AREA ## #################################################### # Send Failure E-Mail open (MAIL, "|/usr/sbin/sendmail -t"); print MAIL <<"END_OF_MAIL"; #line 90 To: $email Reply-to: support\@foo.bar From: support\@foo.bar Subject: Blah Dear $fullname, END_OF_MAIL close (MAIL);

edited: Tue Oct 1 00:07:37 2002 by jeffa - title change (was: Whats Wrong Here)

Replies are listed 'Best First'.
Re: Why do I get an 'uninitialized' warning?
by zigdon (Deacon) on Sep 30, 2002 at 18:04 UTC

    Are you sure that $fullname and $email are defined?

    Just curious, what do all the '=>'s do in the system call? aren't these two lines identical?

    system('/usr/local/bin/AddVirtUser' => "tpasswd=$password", => $domain, => $username, => $fullname, => 5, => '0 0 0', )
    and
    system('/usr/local/bin/AddVirtUser' => "tpasswd=$password", undef, $domain, undef, $username, undef, $fullname, undef, 5, undef, '0 0 0', undef)
    ?

    -- Dan

      I don't know why i did it like that. What is the proper way of passing those variables to the AddVirtUser command?

        Not so much about the AddVirtUser command, but about the system command - just pass the parameters as a list: exactly what you did, just leave out the "=>"s.

        -- Dan

Re: Why do I get an 'uninitialized' warning?
by RMGir (Prior) on Sep 30, 2002 at 18:04 UTC
    A double-quoted string is translated by perl into a bunch of string concatenation operations.

    So, in this case, I'd look at the values of $email and $fullname to make sure that neither is undefined.

    You might want to check and make sure your open of sendmail succeeds, while you're at it... That's not your problem, but it could bite you down the road.
    --
    Mike

Re: Why do I get an 'uninitialized' warning?
by sauoq (Abbot) on Sep 30, 2002 at 18:05 UTC

    I would guess that one or both of $email and $fullname have not been initialized. Check them to be sure they contain what you think they should.

    -sauoq
    "My two cents aren't worth a dime.";