efrei/scripting/perl/tableaux.pl

40 lines
582 B
Perl
Executable file

#!/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;