#!/usr/bin/perl 

$where_is_perl=`which perl`;

print "Hello, World!\n"; #one has to keep traditions :)
print "On my computer Perl is installed in $where_is_perl\n";

#each statement (or sentence) in Perl language is separated by semicolon ";"
#and comments start with the pound sign #

#variables in Perl are of 3 main types: $calars, @arrays and %hashes. 
# The latter two are described in chapters 3 and 5, 
# chapter 3 is YOUR HOME READING ASSIGNMENT

$string="ATCG";
print "value of \$string is $string\n";
#note that use of backslash in front of dollar sign forced Perl to print variable 
#name instead of variable value

print "Do not mix up backward and forward slash: they have different meaning:\n";
print "1/2/n\n"; #guess what this line prints? 
print 1/2; #and this one?

print "\n\n"; 

#p.22 old textbook has a typo, the last command should have back ticks: ``
$list_me="ls -l";
print "$list_me\n";
print '$list_me';
print "\n";
print `$list_me`; #executes ls -l and prints the result
# print `ls -l`; # would do the same

# perl data type conversion is automatic. 
# Sometimes it is very scary, sometimes unexpected
# BE VIGILANT!

$gi_number1="15605613";
$gi_number2="15605614";
print "\$gi_number1=$gi_number1\n";
print "\$gi_number2=$gi_number2\n";

print "\$gi_number1+\$gi_number1 = $gi_number1+$gi_number2\n"; 
#This works because the two variables are interpolated separately, and the + is considered string

print '$gi_number1+$gi_number1 = '; 
print $gi_number1+$gi_number2; #Perl easily sums two gi numbers although we had them as strings
print "\n\n";

#lower and upper case matter
$MY_VAR="hello\n";
print "$my_var"; #does not really print anything if no "-w" switch used, prints warning otherwise 
 
print "\n";

