[PLUG] Perl
Roderick A. Anderson
raanders at acm.org
Mon Jul 3 22:10:26 UTC 2006
Colin Kuskie wrote:
> On Mon, Jul 03, 2006 at 12:09:17PM -0700, Roderick A. Anderson wrote:
>
>
>>sub getpassdb {
>> # Read password file creating usernames and
>> # passwords hash.
>>
>> my %passworddb;
>>
>> local $file_passwd = "/root/firewall/var/cgi_password" ;
>>
>> open ( $INPASS, '<', $file_passwd" )
>> or die "Error--unable to open $file_passwd $!" ;
>>
>> while ( my $passline = <{ $INPASS }> ) {
>>
>> chomp $passline;
>>
>> %passworddb = ( $passworddb, ( split ( '=', $passline ) ) );
>>
>> return %passworddb;
>>}
>
>
> I don't think that code will compile. At the very least you have to
> close the while block.
You're right. I was trying to pop that off while do _too_ many other
things at the same time. I did test the
%passworddb = ( %passworddb, ( split ( '=', $passline ) ) );
line construct.
Rod
--
>
> $passworddb should be changed to %passworddb so that it will append
> to the hash, and the subroutine isn't clean for a use strict.
>
> Colin
> _______________________________________________
> PLUG mailing list
> PLUG at lists.pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug
More information about the PLUG
mailing list