Thread Use of uninitialized value ...: Hash mit Array als value (undef) (14 answers)
Opened by Duff at 2007-07-10 16:56

renee
 2007-07-12 10:55
#78356 #78356
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
*WAS* funktioniert nicht??

Das hier läuft einwandfrei:
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
#!/usr/bin/perl

use strict;
use warnings;

my %hash = (
  key1 => ['dies'],
  ist  => ['ein'],
  Test => ['hallo'],
  was => ['wert'],
  los  => ['hash'],
);



for my $k (sort { $hash{$a}->[0] cmp $hash{$b}->[0] or $a cmp $b } keys %hash) {
       my @arr = grep { defined $_ } @{ $hash{$k} };

       if (@arr) {
            printf "%-25s : %-80s\n", $k, "@arr";
       }
}
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/

View full thread Use of uninitialized value ...: Hash mit Array als value (undef)