Silly me. Typing something from memory when I know how bad my memory is. Here's a correct version (which was cheerfully misremembered from Damian Conway):
#!/usr/bin/perl use warnings; use strict; use Data::Dumper; use vars '@var'; my @array = qw( foo bar baz ); *var = alias_to(@array[1,2]); print Dumper \@var; $var[1] = 'silly me'; print Dumper \@array; sub alias_to { \@_ }
Cheers,
Ovid
New address of my CGI Course.
In reply to Re: Re: Re: use simple scalar names to point to specific array elements
by Ovid
in thread use simple scalar names to point to specific array elements
by Sandy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |