in reply to faulty expression prob
I suspect you are running into a precedence issue, specifically with the conditional operator (?:) and the assignment operator (=). See perlop.
Personally, though, I found the code hard to read. I'd probably write it something like this:
$rh = $pkg->{'RPM_HDR'}; $dist = $rh->tag('DISTRIBUTION'); # or $dist = $pkg->{'RPM_HDR'}->tag('DISTRIBUTION'); $pkg->{DIST} = $dist ? $dist : $undef; # $undef or undef?
Update: Given how you are testing for truth, keep in mind what Perl considers to be a true value (vs a defined value). See True or False? A Quick Reference Guide for examples.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: faulty expression prob
by ikegami (Patriarch) on Apr 03, 2008 at 07:55 UTC | |
by perl-diddler (Chaplain) on Apr 03, 2008 at 23:17 UTC | |
by ikegami (Patriarch) on Apr 04, 2008 at 00:32 UTC | |
|
Re^2: faulty expression prob
by apl (Monsignor) on Apr 03, 2008 at 10:59 UTC |