Sunday, October 9, 2011

if with perl

Simple if construction,
reads the name into a variable,
then looks if the name is eqal (because this eq)
then prints the first block, if not print the other block.

#!/usr/bin/perl -w
use strict;
print "Your name:\n";
my $a = ;

if ($a eq "Alpha")
{
print "Hello Alpha\n";
}
else
{
print "You not Alpha\n";
}

No comments:

Post a Comment