PetaMem has asked for the wisdom of the Perl Monks concerning the following question:
Dear monks,
I'm humbly asking for explanation of basic perl knowledge. What puzzles me is that I'm having a code like that:
which works very well. This is the beginning of a subroutine and all I want is to have in lexlist either a list of elements I gave as arguments to this routine or - if none were given - to create this list from some hash.my @lexlist = @_; @lexlist = sort keys %lexicon if(!@lexlist);
My problem is, that me thinks the following should be possible also:
unfortunatedly this doesn't work at all and I have no clue why. It seems, that @_ is always evaluated to a true value even if it is empty. Why this exceptional behaviour?my @lexlist = @_ or sort keys %lexicon;
I'm sure I'm missing something very very basic...
Bye
PetaMem
Back to
Seekers of Perl Wisdom