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

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
Below is the code in question:
my $files_to_send = map {"$stage/$_.pdf"} @{$self->_getGood()}; print map {"$_\n"} @{$files_to_send};
which returns
Can't use string ("6") as an ARRAY ref while "strict refs" in use at M +oduleName.pm line 136.
I have a sub _getGood() that collects the *good* files I want to process/send in my script. This sub returns an array:
sub _getGood { my ($self,@args) = @_; print "_getGood()", Dumper $self->{_good}; return @{$self->{_good}}; }
I have the Dumper in there for good measure, just to see that I am indeed returning what I want return, an array. The Dumper output prints the following:
$VAR1 = [ 'C21622241', 'C21594007', 'C21619147', 'C21572375', 'C21611603', 'C21617783' ];
At one point in time a variation of this was working, now it's not and I don't see the problem. Besides assigning map to a scalar, I can't see what is amis. I even went so far as to declare $files_to_send = []; like so, and I still get the same results.

ideas? I can get this to work by assigning to an array as opposed to a reference, but that would require extra lines of code :)



-silent11
Spread Firefox

In reply to map return to array reference by silent11

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!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others imbibing at the Monastery: (11)
    As of 2014-08-29 14:05 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      The best computer themed movie is:











      Results (280 votes), past polls