#!/usr/bin/perl -w use strict; # first initialize necessary variables: my $err_msg = "Authorization Failed: please try again\n"; my $cusr = 'bob'; my $cpword = 'pass'; # next obtain the user's data: my($usr, $pword); print "What is your username? "; $usr = ; chomp($usr); print "Please enter your password:\n"; $pword=; chomp($pword); # now we can authenticate or die unless ($usr eq $cusr and $pword eq $cpword) { die $err_msg; } print "Authentication Complete!\n"; # authorized file processing may ensue: my @lines; my $file = 'memberlist.txt'; open (FILE, $file) || die "Can't open $file: $!"; while(){ push @lines,$_; } close FILE; # now do whatever with @lines. print @lines; __END__