Thread Code mittels map vereinfachen (3 answers)
Opened by ingobulla at 2012-02-23 18:06

Linuxer
 2012-02-23 18:17
#156378 #156378
User since
2006-01-27
3871 Artikel
HausmeisterIn

user image
Hi,

z.B. so:

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#! /usr/bin/perl
use strict;
use warnings;
use List::Util qw( min );

my %hash = (
    't1' => [0.5, 0.8],
    't2' => [0.6, 0.9],
    't5' => [0.4, 0.2],
);

my $min = min map { $hash{$_}->[0] } keys %hash;

print "Min: $min\n";
meine Beiträge: I.d.R. alle Angaben ohne Gewähr und auf Linux abgestimmt!
Die Sprache heisst Perl, nicht PERL. - Bitte Crossposts als solche kenntlich machen!

View full thread Code mittels map vereinfachen