Frank Escobar
New member
Below is my code, basically if the answer is "Y" then the script runs a message if it's something else then it closes.
When I type "Y" it works but when I type something else the same thing happens as if you were to type "Y"
What's wrong with my code?
#! usr/bin/perl
print "Do you wish to run Program? [Y/N]:";
$answer = <>;
if($answer = Y) {
print "COOOL\n";
} else {
system "exit"
}
I tried..
#! usr/bin/perl
print "Do you wish to run Program? [Y/N]:";
$answer = <>;
if($answer == Y) {
print "COOOL\n";
} else {
system "exit"
}
Still does not work!
#! usr/bin/perl
print "Do you wish to run Program? [Y/N]:";
$answer = <>;
if($answer == "Y") {
print "COOOL\n";
} else {
system "exit"
}
When I type "Y" it works but when I type something else the same thing happens as if you were to type "Y"
What's wrong with my code?
#! usr/bin/perl
print "Do you wish to run Program? [Y/N]:";
$answer = <>;
if($answer = Y) {
print "COOOL\n";
} else {
system "exit"
}
I tried..
#! usr/bin/perl
print "Do you wish to run Program? [Y/N]:";
$answer = <>;
if($answer == Y) {
print "COOOL\n";
} else {
system "exit"
}
Still does not work!
#! usr/bin/perl
print "Do you wish to run Program? [Y/N]:";
$answer = <>;
if($answer == "Y") {
print "COOOL\n";
} else {
system "exit"
}