Variable Scopes:
my only "local" not assigned outside the "loop" e.g.
global:
use vars qw($var1 $var2);
while (){
$var1 = 0
}
####
perldoc perlintro
perldoc perltoc
perldoc perlfaq[1-x]
quote delimiter(s), \, $, and @,
####
#!/usr/bin/perl
@words = ("one","two","three","four","five");
foreach $elem (@words){
print "$elem\n";
}
####
#!/usr/bin/perl -w
#We use warnings
#test if a number is odd or even using modulus:
for ($i = -3; $i <=11; $i++) {
$mod = $i %2;
if ($mod == 0){ printf "$i is even, modulus is $mod \n";
}
if ($mod == 1){ printf "$i is odd, modulus is $mod \n";
}
}
####
#!/usr/bin/perl
#use 5.006;
#use strict;
use warnings;
open (IN, "+;
seek IN,0,0;
foreach $file (@file){
$file =~ s/muster1/\#\ muster2/i;
#$file =~ s/muster1/\#\ muster2/ig;
print IN $file;
}
close IN;
#l15 s/ersetze/mit/ig
#l15 bei \ muster2 wird zusätzliche ein # und ein leerzeichen eingefügt
#l15 s /i= case insensitive g = global alle
#l18 filehandle schliessen
#ohne g nicht global wird nur 1x ausgeführt
# rofl: print map {chr (((hex A0)/2+3)+$_)}(0,-11,-10,1)
grep:
[id://811976]
hashes:
[id://563314]