#!/usr/bin/perl use strict; use warnings; use diagnostics; use Cwd; # input files to work on my $file= "$ARGV[0]"; open INFILE, '<', $file, or die "Can't open $file : $!"; my %aircraftID; while (my $line = ){ chomp($line); my @Elements = split ';', $line; # the command shift takes away the first element of the table and stocks it in a variable my $aircraft_id = shift(@Elements); # the element of the first column (the aircraft_id) has been taken from Elements # a hash table cannot contain lists # that's why a reference to a list is needed # this reference is called by the antislash \ my $row = \@Elements; push @{$aircraftID{$aircraft_id}}, @{$row}; print STDOUT "la row2 vaut @{$row}\n"; } close INFILE; print STDOUT "\n"; foreach my $cle (keys %aircraftID){ print STDOUT "the value of $cle is : \n"; print STDOUT "@{$aircraftID{$cle}}\n"; }