Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Here is a code snippet from a tutorial i was looking at on the web
This code has a use strict directive in it so I don't understand how it can call the md5_hex function without qualifying it with the full package name. I thought 'use strict' forces you declare lexical variables using 'my' and to reference to package variables and functions with their full names. many thankspackage TestSite::Login; $VERSION = v0.0.1; use v5.10.0; use warnings; use strict; use Carp; use Digest::MD5 'md5_hex'; open(my $fh, '<', 'passwords') or die "cannot open passwords file $! +"; my %passwords = map({chomp; split(/:/, $_, 2)} <$fh>); sub check_password { my ($user, $pass) = @_; return( $passwords{$user} and md5_hex($pass) eq $passwords{$user} ); } 1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: beginner - understanding use strict
by kennethk (Abbot) on Oct 16, 2010 at 16:23 UTC | |
|
Re: beginner - understanding use strict
by Anonymous Monk on Oct 16, 2010 at 16:27 UTC |