Thread Filehandle. Output-Datei generieren (17 answers)
Opened by incubus at 2015-02-23 16:39

Gast wer
 2015-02-23 21:39
#179854 #179854
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
#!/usr/bin/perl

use strict;
use warnings;

my @list = qw(a b c);
my %fh;
foreach my $f(@list){
        foreach my $s(@list){
                my $key = $f.$s;
                open($fh{$key}, ">", "fh_$key.txt") or die;
        }
}

while(<DATA>){
        chomp;
        my $sub = substr($_, 0,2);
        print  $fh{$sub} "$sub\n";
}

__DATA__
aaK
acK
bcK
baK
bbK

Last edited: 2015-02-23 21:44:18 +0100 (CET)

View full thread Filehandle. Output-Datei generieren