At 06:49 AM 9/3/00 -0600, Tom Christiansen wrote: > > sub fn { return (3,5,7) } > > $x = fn; # I want $x==3 > >Why should it return the first one? It returns the last one! >It's just doing what you told it, which was: > > $x = 3; > $x = 5; > $x = 7; It does? What's happening here, then? $ cat /tmp/foo #!/usr/bin/perl -wl package MaiTai; sub TIESCALAR { bless \$_[1] } sub FETCH { print "FETCH"; $$_[0] } sub STORE { print "STORE: ", $$_[0] = $_[1] } package main; sub fn { return (3, 5, 7) } tie $x, 'MaiTai'; $x = fn; $ /tmp/foo STORE: 7 Why don't I see three STOREs? >and you're left with 7. -- Peter Scott Pacific Systems Design Technologies
- Re: The distinction between "do BLOCK while COND&qu... Chaim Frenkel
- Re: The distinction between "do BLOCK while COND&qu... Tom Christiansen
- Re: The distinction between "do BLOCK while COND&qu... Chaim Frenkel
- Re: The distinction between "do BLOCK while COND&qu... Tom Christiansen
- Re: The distinction between "do BLOCK while COND&qu... Chaim Frenkel
- Re: The distinction between "do BLOCK while COND&qu... Tom Christiansen
- Re: The distinction between "do BLOCK while COND&qu... Chaim Frenkel
- Re: The distinction between "do BLOCK while COND&qu... Tom Christiansen
- Re: The distinction between "do BLOCK while COND&qu... Chaim Frenkel
- Re: The distinction between "do BLOCK while COND&qu... Tom Christiansen
- Re: The distinction between "do BLOCK while COND&qu... Peter Scott
- Re: The distinction between "do BLOCK while COND&qu... Tom Christiansen
- Re: The distinction between "do BLOCK while COND&qu... Peter Scott
- Re: The distinction between "do BLOCK while COND&qu... Nathan Torkington
- Re: The distinction between "do BLOCK while COND&qu... Tom Christiansen
- Re: The distinction between "do BLOCK while COND&qu... Chaim Frenkel