|
|
|
Your skill will accomplish what the force of many cannot |
|
| PerlMonks |
Re: Re: Re: How's your Perl?by tilly (Archbishop) |
| on Oct 27, 2003 at 18:22 UTC ( [id://302567]=note: print w/replies, xml ) | Need Help?? |
This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.
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.
In Section
Meditations
|
|
||||||||||||||||||||||||||||