I have this code

```
#!/usr/bin/perl

use warnings;
use strict;

my $nis = "qqq";
my $grp = "pre-qqq";

if ($nis eq $grp || 'pre-' . $nis eq $grp) {
    print "match1\n";
}

if (($nis || 'pre-' . $nis) eq $grp) {
    print "match2\n";
}

```

where the first `if`-statement works, but the second doesn't.

What is wrong with the second?

Can it be done without repeating the variables twice?