Difference between revisions of "perl notes"

From thelinuxwiki
Jump to: navigation, search
Line 8: Line 8:
  
 
===interpolation===double quotes get the value of a variable
 
===interpolation===double quotes get the value of a variable
−
<source lang="python">
+
<source lang="python">
−
my $amount = 20;
+
my $amount = 20;
−
print "$amount\n";
+
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