in reply to Pimp my code - Schwartzian transform maybe?

Heh, here's one way to do it that avoids the string of if statements:

sub flagValue { my ($flags, $item) = @_; my $flagOrder = ' RTBIFL'; (-1 != index $flags, substr $flagOrder, $_, 1) and return $_ for 1..length($flagOrder); }

DWIM is Perl's answer to Gödel