Thread Datei einlesen und aufteilen (12 answers)
Opened by Kurtosis at 2015-04-20 14:17

GwenDragon
 2015-04-20 15:51
#180741 #180741
User since
2005-01-17
14554 Artikel
Admin1
[Homepage]
user image
Tun sie doch.

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use feature qw(say);
my $fh = *DATA;
my (@x, @y, @z, @W);          
my $line = <$fh>; 
while ( $line = <$fh> ) {    
  chomp $line;                             
  my ($x, $y, $z, $W) = split /\t/,$line;  
  
  # einzelne Daten in Arrays speichern
  push @x,$x//''; 
  push @y,$y//''; 
  push @z,$z//''; 
  push @W,$W//''; 
}

say $_ for (@x);
say $_ for (@y);
say $_ for (@z);
say $_ for (@W);


__DATA__
x       y       z       W
1       22      19      ABC
9       1       22      XYZ



ergibt:
1
9
22
1
19
22
ABC
XYZ
die Drachin, Gwendolyn


Unterschiedliche Perl-Versionen auf Windows (fast wie perlbrew) • Meine Perl-Artikel

View full thread Datei einlesen und aufteilen