Add perl scripts
This commit is contained in:
parent
b8943643c3
commit
cb5f3ea514
2 changed files with 54 additions and 0 deletions
14
scripting/perl/boucles.pl
Executable file
14
scripting/perl/boucles.pl
Executable file
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/env perl
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $rock;
|
||||
|
||||
foreach $rock (qw/rock lava rain/) {
|
||||
print "$rock\n";
|
||||
}
|
||||
|
||||
foreach (1..10) {
|
||||
print "$_\n";
|
||||
}
|
40
scripting/perl/tableaux.pl
Executable file
40
scripting/perl/tableaux.pl
Executable file
|
@ -0,0 +1,40 @@
|
|||
#!/usr/bin/env perl
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my @chiffres = (1,3,4,2,3);
|
||||
|
||||
print "@chiffres\n";
|
||||
print $#chiffres + 1 . "\n";
|
||||
|
||||
my @fred = (1, 2, 3, 4, 5);
|
||||
$fred[0] = "test1";
|
||||
$fred[1] = "test2";
|
||||
$fred[2] = "test3";
|
||||
$fred[3] = "test4";
|
||||
$fred[4] = "test5";
|
||||
|
||||
print "@fred\n";
|
||||
print "@fred ";
|
||||
print "@fred";
|
||||
|
||||
my @test = (1..5);
|
||||
print "@test\n";
|
||||
|
||||
my @popped = 5..9;
|
||||
print pop(@popped);
|
||||
print "\n";
|
||||
push @popped, 4;
|
||||
print @popped;
|
||||
print "\n";
|
||||
|
||||
my $m = shift @popped;
|
||||
print "$m\n";
|
||||
my $n = shift @popped;
|
||||
print "$n\n";
|
||||
print @popped;
|
||||
print "\n";
|
||||
|
||||
$m = unshift(@popped, 1);
|
||||
print @popped;
|
Loading…
Reference in a new issue