Bonjour,
J'ai un fichier de 100 colonnes et 15000 lignes (cf. exemple avec 6 champs)
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
 
X	AATAAA	TTATCC	VRWAAAGYDM	AACGTGT	WWASCGYGT
MAIZE01040	0	0	1	1	0
MAIZE1040	1	0	0	1	1
MAIZE0000	0	0	1	1	0
Ma question est comment ne pas indiquer tous les champs? cf. cis-dessous $champ1, $champ2,...champ5
Merci de votre aide

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
 
use strict;
use warnings;
 
my $fichier = 'test.csv';
open my $fh, '<', $fichier or die "Impossible de lire le fichier $fichier\n";
my %data;
 
while(my $ligne = <$fh>){
	chomp $ligne;
	if($ligne =~ /MAIZE([0-9]*).*/){
		my ($gene,$champ1,$champ2,$champ3,$champ4,$champ5) = split "\t", $ligne;
		my $element =$champ1."\t".$champ2."\t".$champ3."\t".$champ4."\t".$champ5;
		push @{$data{$gene}}, [$element];
	}
}