Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Learning to *really* love references

by japhy (Canon)
on Jul 30, 2002 at 03:49 UTC ( [id://186130]=note: print w/replies, xml ) Need Help??


in reply to Learning to *really* love references

Perl really needs better aliasing features. Currently, you can only create an alias with a package variable (using a glob) or in a for-loop. Other methods require you to use tie() or some other less elegant means.

_____________________________________________________
Jeff[japhy]Pinyan: Perl, regex, and perl hacker, who'd like a job (NYC-area)
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;

  • Comment on Re: Learning to *really* love references

Replies are listed 'Best First'.
Re: Re: Learning to *really* love references
by demerphq (Chancellor) on Jul 30, 2002 at 15:53 UTC
    While afaik you cant alias scalar directly you can do aliasing with arrays and hashes using Array::RefElem and even do aliasing with arrays without anything more than the following utility sub:
    sub alias_array { \@_ }
    But you are right, perl needs better ways to define and manipulate aliases.

    Yves / DeMerphq
    ---
    Writing a good benchmark isnt as easy as it might look.

Re: Re: Learning to *really* love references
by Boots111 (Hermit) on Jul 31, 2002 at 12:25 UTC
    Monks~

    Well, it might not do much now, but Perl6 will support aliasing via the := operator...

    That doesn't help you in the short run, but after reading the apocalypses (especially 4) I have been waiting with bated breath for Perl6.

    Boots
    ---
    Computer science is merely the post-Turing decline of formal systems theory.
    --???
Re: Re: Learning to *really* love references
by jdporter (Paladin) on Aug 01, 2002 at 21:12 UTC
    you can only create an alias with a package variable (using a glob) or in a for-loop.

    Not quite true, Japhy. In a subroutine call, the elements of @_ are aliased to the actual arguments.

    I find that that and the for-loop technique answer about 98% of my aliasing needs.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://186130]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (6)
As of 2024-04-19 11:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found