Thread Elegante Syntax (9 answers)
Opened by bianca at 2013-04-06 18:30

rosti
 2013-04-09 19:10
#166993 #166993
User since
2011-03-19
3150 articles
BenutzerIn
[Homepage]
user image
Affengeil ;)

Idee: Noch schiel föner mit einem Hash-Slice:
Code (perl): (dl )
1
2
3
4
5
6
7
my $date = '20130409190203';
my @h = qw(Jahr Monat Tag Stunde Minute Sekunde);

my %hunt = ();
@hunt{@h} = unpack('A4A2A2A2A2A2', $date);

print Dumper \%hunt;


Das gibt dann aus:
Code: (dl )
1
2
3
4
5
6
7
8
$VAR1 = {
'Jahr' => '2013',
'Minute' => '02',
'Sekunde' => '03',
'Stunde' => '19',
'Monat' => '04',
'Tag' => '09'
};

View full thread Elegante Syntax