Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^2: A different OO approach

by Aristotle (Chancellor)
on Dec 15, 2002 at 02:25 UTC ( #219942=note: print w/ replies, xml ) Need Help??


in reply to Re: A different OO approach
in thread A different OO approach

my @ATTR = \my (%Attr1, %Attr2, %Attr3);

Makeshifts last the longest.


Comment on Re^2: A different OO approach
Download Code
Re^3: A different OO approach
by adrianh (Chancellor) on Dec 15, 2002 at 03:22 UTC

    ++ That is very nice. I didn't realise that you could use my and \() like that. Learn something new every day!

    The only pain is that you have to remember to do:

    my @A = \my %Foo;

    not

    my @A = \my (%Foo);

    ... which could lead to some nasty buggettes if you're not careful.

      Odd. I didn't even notice. I'm not sure I understand - I shuffled parens around but there's no difference. This is funny and sort of embarrassing.. what am I missing?

      Makeshifts last the longest.

        A single hash is a special case with \(). From perlref.

        As a special case, "\(@foo)" returns a list of refer- ences to the contents of @foo, not a reference to @foo itself. Likewise for %foo, except that the key refer- ences are to copies (since the keys are just strings rather than full-fledged scalars).

        Annoying eh?

delete me
by NodeReaper (Curate) on Dec 15, 2002 at 03:25 UTC

    Reason: adrianh delete. dupe.

    For more information on this node visit: this

Re: Re^2: A different OO approach
by shotgunefx (Parson) on Dec 15, 2002 at 20:40 UTC
    I thought I remembered seeing it done something like that. I had tried my \(%Attr1,%Attr2,%Attr3). Thanks for the tip.

    -Lee

    "To be civilized is to deny one's nature."

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (12)
As of 2014-08-29 23:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (289 votes), past polls