Clear questions and runnable code
get the best and fastest answer
Linked List Strangenessby Mandor (Pilgrim)
|on Jan 31, 2002 at 17:25 UTC||Need Help??|
Mandor has asked for the
wisdom of the Perl Monks concerning the following question:
Since we've been doing linked lists in computer science
class recently but are unfortunately using the ol' Pascal
(which I've grown to dislike) I decided to code the same
simple program we finished in class - this time in Perl to see how it works.
After reading a little on that topic I made an implementation
like this :
Interestingly I found out that this wasn't working.
Debugging it with Komodo 1.1 I found that after
$list wasn't being set, which kinda defeated it's purpose.
Then I changed the implementation to this :
I removed the variable passing and accessed $list and $lastnode directly.
And well, now it worked. But I don't get why passing the variable
makes example 1 don't work.
I am thankful for enlightenment.