The other solutions mention how to do things with an array reference. That's probably what you want, but just because there are other ways (so I've heard), if you want your method to accept arrrays for whatever reason, you could do something along the following lines in your method:

sub clientcrgunit { my ($self, @stuff) = @_; $self->{clientcrgunit} = \@stuff; }

The first thing passed to the method is the reference to the object, the rest will be slurped into @stuff; if you want to accept either arrays *or* array references, you could check to see whether @stuff has one member, and if that member is a reference to an array:

sub clientcrgunit { my ($self, @stuff) = @_; if ( @stuff == 1 && ref($stuff[0] eq 'ARRAY') ) { $self->{clientcrgunit} = $stuff[0]; } else { $self->{clientcrgunit} = \@stuff; } }
perl -e 'print "How sweet does a rose smell? "; chomp ($n = <STDIN>); +$rose = "smells sweet to degree $n"; *other_name = *rose; print "$oth +er_name\n"'

In reply to Re: Putting contents of an array into Object property by arturo
in thread Putting contents of an array into Object property by fmogavero

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.