Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Fibonacci numbers with lvalues

by ariels (Curate)
on Nov 30, 2000 at 13:14 UTC ( [id://44096]=CUFP: print w/replies, xml ) Need Help??

This snippet shows how to use an expression as an lvalue. It's based on something my boss said you could only do in Algol68.
($a,$b) = (0,1); ($a < $b ? $a : $b) = $a+$b for (1..$n); print $n%2 ? $a : $b, "\n"

Replies are listed 'Best First'.
Re: Fibonacci numbers with lvalues
by Adam (Vicar) on Dec 01, 2000 at 07:11 UTC
    Heh, that's pretty cool.

    (For a moment there I was gonna point out that you missed the whole Fibonacci thread, but your post isn't really about the series, its about assigning to an expression.)

    ARGH! Thanks to the power of Preview I was checking that link and discovered that half the Fibonacci thread is missing (the TOP half!) I'll have to msg Vroom about that. Part of the bottom half of that thread is RE: RE (tilly) 1: Fibonnaci. Notice the links to the top half don't exist. Very weird.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: CUFP [id://44096]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (3)
As of 2024-04-18 02:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found