Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: map return to array reference

by liverpole (Monsignor)
on Jan 24, 2007 at 17:05 UTC ( #596288=note: print w/ replies, xml ) Need Help??


in reply to map return to array reference

Hi silent11,

Since you're assigning to an array reference (my $files_to_send = ...), you should enclose the results of the map in [ ... ]:

my $files_to_send = [ map {"$stage/$_.pdf"} @{$self->_getGood()} ];

Otherwise, you're assigning to the count of the items in the array (using the array in scalar context).

Oh, and you could also simplify @{$files_to_send} to just @$files_to_send.  In fact, if you don't care about printing newlines, you might make it really simple:

print "@$files_to_send\n";

s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/


Comment on Re: map return to array reference
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2015-07-06 01:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (68 votes), past polls