Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re: @_ still mystifies me

by cLive ;-) (Parson)
on Jun 01, 2002 at 15:33 UTC ( #170920=note: print w/ replies, xml ) Need Help??

in reply to @_ still mystifies me

Presedence. "@_ is always evaluated to a true" - No, "@lexlist = @_" is.

I think these braces are in the right place:

my @lexlist = @_ or sort keys %lexicon; # read as (my @lexlist = @_) or (sort keys %lexicon);
What you want is:
my @lexlist = @_ || sort keys %lexicon; # read as my @lexlist = (@_ || sort keys %lexicon);
Or use braces:
my @lexlist = (@_ or sort keys %lexicon);
Hopefully the braces make it a little more readable :) or, and & not have much lower presedence than || && and !

In my experience, to avoid such confusion, I avoid the English versions...

cLive ;-)

Update: see below :) /me eats humble pie and revisits old scripts to see why this has never caused me a problem b4...

Comment on Re: @_ still mystifies me
Select or Download Code
Replies are listed 'Best First'.
Re^2: @_ still mystifies me
by Aristotle (Chancellor) on Jun 01, 2002 at 18:36 UTC
    This won't work because or forces scalar context on its operands.
    Update: Thanks, merlyn.
    Makeshifts last the longest.
Re: Re: @_ still mystifies me
by Anonymous Monk on Jun 01, 2002 at 17:32 UTC
    You didn't test your code, and your answer doesn't work.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://170920]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2015-10-04 21:52 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (105 votes), past polls