[TUT] Perl Login script | If / Else [Beginner LVL 3] 05-10-2011, 09:58 PM
#1
hey and welcome to my perl login script. This is a very simple look at perl and user logins but does use the if else statements well, hope you enjoy.
so here is the over all code.
Explanation.
just means, newline.
All this does is prints the text in the Quotation marks.
this just sets the variable that, my $input = "Root"
now this is slightly more complex, "my $user" is the Variable and "<STDIN>" simply stands for Standard input. This is where the text is entered.
now the If Else statement, this just says that IF $user (the Variable / input text) = "Root" / $input. then it print's the text "Welcome..." else it print's the text "Access denied tracing IP".
very simple very easy to understand. Hope you enjoyed this Perl Tutorial.
so here is the over all code.
Code:
print"\n\n----# Login #----\n";
print"\nUsername: ";
my $input = "Root";
my $user = <STDIN>;
if ($user eq $input) {
print"Welcome...";
}
else {
print"Access denied tracing IP";
}Explanation.
Code:
\nCode:
print"\n\n----# Login #----\n";
print"\nUsername: ";All this does is prints the text in the Quotation marks.
Code:
my $input = "Root";Code:
my $user = <STDIN>;now this is slightly more complex, "my $user" is the Variable and "<STDIN>" simply stands for Standard input. This is where the text is entered.
Code:
if ($user eq $input) {
print"Welcome...";
}
else {
print"Access denied tracing IP";
}now the If Else statement, this just says that IF $user (the Variable / input text) = "Root" / $input. then it print's the text "Welcome..." else it print's the text "Access denied tracing IP".
very simple very easy to understand. Hope you enjoyed this Perl Tutorial.
![[Image: 6caf54.gif]](http://i25.lulzimg.com/6caf54.gif)
![[+]](https://sinister.ly/images/modern/collapse_collapsed.png)