sub def {
$_[0]= def($_[1],"") if ! defined $_[0];
return $_[0];
}
then you can do this as:
$ext{index} = 'pod';
for my $pod ( qw( HostCycle Instinet index ) ) {
system "pod2html $pod" . def($ext{$pod},".pm") . " > $pod.html";
}
def (short for "define" which would be too
easy to confuse with "defined") is useful for avoiding
warnings. You can use it like || as above
or like ||=. It differs from these two
operators in that it triggers on definedness rather than
truthness.
Note that def is so useful that even
def uses it. ;)
-
tye
(but my friends call me "Tye") |