Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re: @_ still mystifies me

by cLive ;-) (Prior)
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...

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]
[LanX]: but I#d be interested to see a demonstration in your scratchpad
[LanX]: # python scoping bug
[shmem]: see my scratchpad. Look for userDict

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (10)
As of 2018-03-20 18:02 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (256 votes). Check out past polls.