1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
sub generate_condition {
    my ( $test, $bound ) = @_;
    return sub { return $test >= $bound; };
}

my %condition;
my $degree = 6;

$condition{'hub'}{'1'} = generate_condition( $degree, 5 );

$parameter='hub';

# prints "true"
if( $condition{$parameter}{1}->() ) { print "true!";  }

$degree = 1;

# prints "still true?"
if( $condition{$parameter}{1}->() ) { print "still true?";  }