I've got impossible error from Perl:
"Can't use string ("string") as a HASH ref while "strict refs" in use at C:\... line 1190"
What the heck should be this error ?
I searched the Web, and here what I got:
code 1:
#!/usr/bin/perl -w use strict; sub showArray(\@) { my(@arr) = @{(shift)}; my($temp); foreach $temp (@arr) { print "$temp\n"; } } sub higherLevel(\@) { my(@arr) = @{(shift)}; showArray(@arr); } my(@arr) = ("one","two","three"); higherLevel(@arr);
Code 2:
#!/usr/bin/perl -w use strict; sub higherLevel(\@) { my(@arr) = @{(shift)}; showArray(@arr); } sub showArray(\@) { my(@arr) = @{(shift)}; my($temp); foreach $temp (@arr) { print "$temp\n"; } } my(@arr) = ("one","two","three"); higherLevel(@arr);
The first code went great, but the second returned the previous error !
I do not understand, the two sections are the same !!!
What the heck is going on?
Mosh.
In reply to a HASH ref while "strict refs" ERROR by mosh
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |