If by alias you mean a second reference to the same variable, you can use standard perl references.
You will probably want to read perlref to get an idea of how that works. There are lots of "special" variables (perlvar), and I cant think of many uses for this, but this certainly works:
#!/usr/bin/perl use strict; use warnings; $_ = "Hello"; print '$_: ' . $_ . "\n"; my $test = \$_; print '$test: ' . $test . "\n"; print '$$test: ' . $$test . "\n"; print '$|: ' . $| . "\n"; $test = \$|; print '$test: ' . $test . "\n"; print '$$test: ' . $$test . "\n"; $|++; print '$|: ' . $| . "\n"; print '$test: ' . $test . "\n"; print '$$test: ' . $$test . "\n";
This isn't a particularly pretty piece of code, but I've separated it all out so that you can see whats going on.
In reply to Re: alias of a variable
by barns
in thread alias of a variable
by vinoth.ree
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |