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";
}

hello world in perl

for a special problem i have to teach myself a programming language.
i decieded for perl because i thought a friend use it too.
after the first lessons i hear that he work with python.
but now i stay at perl.

here the classic "hello world":

#!/usr/bin/perl -w
use strict;
print "hello world\n";


very ease, i save it as .pl file,
then change it to executable with:
chmod +x test.pl
and simple execute it.
./test.pl

and enjoy myself at the hello world

Blog has moved

Now with a new adress,
i think much cooler than before :-)