perlquestion
silent11
Below is the code in question:
<code>
my $files_to_send = map {"$stage/$_.pdf"} @{$self->_getGood()};
print map {"$_\n"} @{$files_to_send};
</code>
which returns
<code>
Can't use string ("6") as an ARRAY ref while "strict refs" in use at ModuleName.pm line 136.
</code>
I have a sub _getGood() that collects the *good* files I want to process/send in my script. This sub returns an array:
<code>
sub _getGood {
my ($self,@args) = @_;
print "_getGood()", Dumper $self->{_good};
return @{$self->{_good}};
}
</code>
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:
<code>
$VAR1 = [
'C21622241',
'C21594007',
'C21619147',
'C21572375',
'C21611603',
'C21617783'
];
</code>
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 <code>$files_to_send = [];</code> like so, and I still get the same results.
<p>
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 :)
<!-- Node text goes above. Div tags should contain sig only -->
<div class="pmsig"><div class="pmsig-95704">
<br><br>
-silent11<br>
<a href="http://www.spreadfirefox.com/?q=user/register&r=13277">Spread Firefox</a>
</div></div>