Thread split() (10 answers)
Opened by taikahn22 at 2008-04-05 15:13

Gast Gast
 2008-04-05 15:31
#107909 #107909
richtig wäre:
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#! perl
use strict;
use warnings;

my $file='test.txt';

open(test,"<", $file) or die "konnte $file nicht oeffnen ($!)";
while(my $line=<test>)
{
 chomp($line);
 my @pairs=split(/,/,$line);
 for my $pair (@pairs)
 {
  my ($key,$value)=split(/=/,$pair)
  print "$key $value\n";
 }
}
close(test);

View full thread split()