Thread Script-Umstellung ?
(6 answers)
Opened by Paule1 at 2008-02-01 09:11 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 26 27 28 29 30 31 32 33 34 35 36 37 [...] # read files my $data_to_append = &datei_lesen($erste_datei,0); my $full_data = &datei_lesen($andere_datei,1);[...] sub datei_lesen{ # pick parameters my($file,$index) = @_; # open file open(my$fhIN, '<', $file) or die "open failed: $!"; # read data my %data; while (my$line=<$fhIN>) { chomp($line); # split line my @tracts = split('#', $line); # key equals the first tract my $key = $tracts[$index]; my $val = [@tracts]; # push data $data{$key} = [] unless exists $data{$key}; push(@{$data{$key}}, $val); } # close file close($fhIN); # return data reference return \%data; } # datei_lesen OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/) -- Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html Perl-Entwicklung: http://perl-services.de/ |