I dont usually use my
keyword for scopes. But I have decided to do so for submodule. Here is the code:
sub aros{
open my $fh, shift;
while(<$fh>){
my @{"ar" . ++$i} = split unless /\A\s+\z/;
}
}
The purpose is to make a chunk of lists, named with an incremented number at the end of its name. And making them private for the scope of the while loop (the closest block). But when i tried to compile, this error arise:
Can't declare array dereference in "my" at ./a line 4, near "} ="
Can someone explain me, how "my" - scope oriented keywords - works innerly? I supposed that no matter what kind of name is used, or what kind of type (whether scalar or list) is used, the "my" keyword should make it private. Do I suppose wrongly?