The ?: operator is like a condensed if/else block.
my $path;
# if an argument was passed, use it
if (@_) { $path = shift }
# otherwise, use "."
else { $path = "." }
That can be written as my $path = @_ ? shift : "."; -- and if I wanted to be even shiftier (pun intended), I could do my ($path) = (@_, "."); but that's probably rude.
_____________________________________________________
Jeff[japhy]Pinyan:
Perl,
regex,
and perl
hacker, who'd like a (from-home) job
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??; |