Using a scalar as a condition in perl

Viewed 2020

First timer...so let me know if there is anything that I have not paid attention to whilst posing a question.

The question is how to use a scalar as a condition, as the code below does not work.

my @parameter=('hub');

my %condition;
$condition{'hub'}{'1'}='$degree>=5';

foreach (@parameter) {
       if ($condition{$_}{'1'}) {..}
}

I thought that is because the condition is not interpreted correctly, so I also tried the following, which also did not work.

if ("$condition{$parameter}{'1'}") { ..}

Would really appreciate any help. :)

3 Answers
Related