Difference between revisions of "perl notes"

From thelinuxwiki
Jump to: navigation, search
Line 7: Line 7:
 
<source lang="python">our $color='purple';</source>
 
<source lang="python">our $color='purple';</source>
  
===interpolation===double quotes get the value of a variable
+
===interpolation===
<source lang="python">
+
double quotes get the value of a variable
my $amount = 20;
+
<source lang="python">
print "$amount\n";
+
my $amount = 20;
print '$amount\n';
+
print "$amount\n";
+
print '$amount\n';
 +
</source>
 
  20
 
  20
 
  $amount\n
 
  $amount\n
</source>
+
 
 
<source lang="python"></source>
 
<source lang="python"></source>

Revision as of 11:58, 10 May 2021

variables

local

my $color='green';

global

our $color='purple';

interpolation

double quotes get the value of a variable

my $amount = 20;
print "$amount\n";
print '$amount\n';
20
$amount\n