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 :)