It looks like you're new here. If you want to get involved, click one of these buttons!
#!/usr/bin/perl
# ^ We need to tell the compiler where the binary is located (only applies if you are running scripts with ./scriptname.pl, instead of perl scriptname.pl)
my $variable1 = 1;
my $variable2 = \"variable2\"; # Notice the \"
my $variable3 = 'variable3'; # Notice the '
my $variable4 = \"im not $variable3\"; # Notice the \"
my $variable5 = 'im not $variable3'; # Notice the '
print 'VARIABLE1: '.$variable1.\"\n\";
print 'VARIABLE2: '.$variable2.\"\n\";
print 'VARIABLE3: '.$variable3.\"\n\";
print 'VARIABLE4: '.$variable4.\"\n\";
print 'VARIABLE5: '.$variable5.\"\n\";
# ^ \n instructs the compiler to print new line
# ^ Notice how ' and \" is used in different situations through the code.
VARIABLE1: 1
VARIABLE2: variable2
VARIABLE3: variable3
VARIABLE4: im not variable3
VARIABLE5: im not $variable3
^ IMPORTANT DIFFERENCE
#!/usr/bin/perl
my $variable1 = 1 + 1;
my $variable2 = 10 - 11;
my $variable3 = 3 * 3;
my $variable4 = 3 ** 4; # 3 to the power of 4 (3^4)
my $variable5 = 5 / 2; # The outcome will be rounded
my $variable6 = 5 % 2; # Remainder of 5 / 2
my $variable7 = \"$variable1.' != '.$variable2\"; # Concatenation and punctuation once again ( Its the basics!)
my $variable8 = $variable3 x $variable1; # Simple example: my $var = 3 x 9; this means it will print the number three 9 times
print 'VARIABLE1: '.$variable1.\"\n\";
print 'VARIABLE2: '.$variable2.\"\n\";
print 'VARIABLE3: '.$variable3.\"\n\";
print 'VARIABLE4: '.$variable4.\"\n\";
print 'VARIABLE5: '.$variable5.\"\n\";
print 'VARIABLE6: '.$variable6.\"\n\";
print 'VARIABLE7: '.$variable7.\"\n\";
print 'VARIABLE8: '.$variable8.\"\n\";
VARIABLE1: 2
VARIABLE2: -1
VARIABLE3: 9
VARIABLE4: 81
VARIABLE5: 2.5
VARIABLE6: 1
VARIABLE7: 2 != -1
VARIABLE8: 99