Argument .. isn't numeric in array slice

I'm not sure I understand this error in the context of my code

    map {
        my $mySTR = "sample";
        $myArr[$_][0] = $mySTR;                             
    } 0..$#myArr

Argument "sample" isn't numeric in array slice

error is shown for line
my $mySTR = "sample";
NewtonianBAsked:
Who is Participating?
 
ozoConnect With a Mentor Commented:
What is in @myArr and what are you trying to do?
Did you mean something like
do {
        my $mySTR = "sample";
        $myArr[$_][0] = $mySTR;                            
    } for 0..$#myArr
0
 
NewtonianBAuthor Commented:
well that solved it thanks!
After trying your method I realized its what I was wrapping around the map was causing the disturbance.
0
 
NewtonianBAuthor Commented:
cheers!!!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.