in reply to Re: Perl says $!what???
in thread Perl says $!what???

The thing that stumps me is that @info is defined at the start of the sub, taking on the value of the argument. And that value is an array whose values are all defined. @info is defined because it prints to the file. Heres the whole sub excluding the html. Could it be the "#" that is out of place??
I just don't know.
Thanks, Eoin..
sub good { my @info = @_; my $title = "Registration successful!"; my $revised = scalar localtime; my $body = <<HTML; <body> </body> HTML open USRNF,">>$file" or die "Couldn't find user file $file, Perl s +ays $!\n"; print USRNF join "#", @info; print USRNF "\n"; close USRNF; open PASS,">>$pass" or die "Coundn't find user file $pass, Perl say +s $!\n"; print PASS $user_name; print PASS "\\"; print PASS &encryption($password); print PASS "\n"; close PASS; return $title, $body; }

Replies are listed 'Best First'.
Re^3: Perl says $!what???
by Enlil (Parson) on Jan 04, 2003 at 00:00 UTC
    The only way I could get the error back from your sub that you specify is when I pass a value in @info that is not initialized. For example (i took out the irrelevent code so use strict; would not complain about $user_name, $file, not being defined in my tests.)

    1. This code works

    my $house = 1; my $car = 1; my @passed = ($house, $car); my ($t1, $t2) = good(@passed);

    2. Whereas this code does not (well it works, but diagnositics, and warnings both warn you of a possible error.)

    my $house = 1; my $car; my @passed = ($house, $car); my ($t1, $t2) = good(@passed);

    So the conclusion is that somewhere you have a value being passed into the array being passed into your sub, without a value. I hope this makes sense, if not I can try to explain further.

    update: I forgot to mention that the following does not complain either:

    3.

    my $house = 1; my $car; my @passed; my ($t1, $t2) = good(@passed);

    -enlil