I have read that linked lists in perl are slow but I can't quite find an example of one.
Is this a linked list? If so how can I change it without losing any of the functionality?
Is this a linked list? If so how can I change it without losing any of the functionality?
Code:
#!/usr/bin/perl -w
use strict;
system('clear');
my @data;
$data[2] = 'hi there';
my %objREF;
$objREF{poker} = \$data[2];
print "struct example\n";
print "======================================\n";
print "original value:\n";
print_me();
print "change by array value:\n";
$data[2] = 'joker';
print_me();
print "change value by ref:\n";
${$objREF{poker}} = 'batman';
print_me();
print "change the array\n";
$data[2] = 'robin';
print_me();
sub print_me{
print "array is: $data[2]\n";
print "Ref is: ${$objREF{poker}}\n\n";
}