Thread Hash each Konstrution mit Aktion für beide Werte (9 answers)
Opened by marky at 2011-10-22 08:57

GwenDragon
 2011-10-22 16:03
#153403 #153403
User since
2005-01-17
14759 Artikel
Admin1
[Homepage]
user image
Funktioniert so nicht unter Perl 5.12.
Es werden nur Werte geändert, keine Schlüssel.

Testcase:
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use strict;
use warnings;

use Data::Dumper;

print "Perl Version: $] \n\n";

my %FM = (
        '<ABCDE>' => '<XYZ>',
        '<abcde>' => '<xyz>',
        '<asdf>' => '<AsDf>',
        '<123>' => '<456>',
);

print Data::Dumper::Dumper \%FM;

for (%FM) {
    s/<[^>]*>/ /g;
}

print Data::Dumper::Dumper \%FM;


Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Ergibt:

Perl Version: 5.012003

$VAR1 = {
'<123>' => '<456>',
'<asdf>' => '<AsDf>',
'<abcde>' => '<xyz>',
'<ABCDE>' => '<XYZ>'
};
$VAR1 = {
'<123>' => ' ',
'<asdf>' => ' ',
'<abcde>' => ' ',
'<ABCDE>' => ' '
};

Last edited: 2011-10-22 16:05:04 +0200 (CEST)

View full thread Hash each Konstrution mit Aktion für beide Werte