Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Re: Re: How's your Perl?

by tilly (Archbishop)
on Oct 27, 2003 at 23:22 UTC ( #302567=note: print w/replies, xml ) Need Help??


in reply to Re: Re: How's your Perl?
in thread How's your Perl?

If by a fix you mean sub bar {$bar[$_[0]]} $foo = *bar; $bar[1]="hi";, that does not work to the given spec.

Test it with print "yes" if \$foo->(1) eq \$foo->[1] and you see that it fails for me on 5.8.1. Get rid of the backslashes and it works, but the problem is that Perl's functions are pass by reference, return by value. Therefore the return of bar(1) is a new string with the same value as $bar[1], but you get something different by taking a reference to it.

Replies are listed 'Best First'.
Re: Re: Re: Re: How's your Perl?
by xmath (Hermit) on Oct 28, 2003 at 00:27 UTC
    ah yes, you're right.. it needs more than a one-char fix :-)

    the overall idea is still right though (as in, the correct solution is very similar to this), but I overlooked some details of your implementation

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://302567]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2018-07-21 02:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (443 votes). Check out past polls.

    Notices?