in reply to Global symbol requires explicit package name
Any idea how I can get rid of it?
"Global symbol "@state" requires explicit package name"
There are several things not quite correct with your script.
You also do not want to use C for loop in Perl. Though it works, but Let make Perl speak Perl not other language.:)#!/usr/bin/perl use warnings; use strict; use threads::shared; my $tmp = meow(); #my $state = &make_shared_array(); for ( my $i = 0 ; $i < 2 ; $i++ ) { for ( my $j = 0 ; $j < 6 ; $j++ ) { print "$tmp->[$i][$j] \n"; } } my @array = (); #for(my $i=0; $i<222; $i++){ for ( my $j = 0 ; $j < 222 ; $j++ ) { $array[$j] = $tmp->[1][$j]; } if ( $array[0] eq $tmp->[1][0] ) { print " array[0] eq $array[1] \n"; } sub meow { my $i = 0; my $j = 1; my $state = []; ### added Array Ref my @p = ( "grey", "striped", "purrr", "cutest_kitty", "meowing_kitty", "the_lord_of_the_cats" ); my @k = ( "smart_kitty", "striped_sweety", "purrr", "meowing_poes", "social_kitty", "the_lord_of_the_poezen" ); for ( my $f = 0 ; $f < 6 ; $f++ ) { push( @{ $state->[$i] }, $p[$f] ); ### always remember the +arrow -> push( @{ $state->[$j] }, $k[$f] ); ### always remember the +arrow -> } return $state; ### added explict return }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Global symbol requires explicit package name
by bebe (Novice) on Aug 13, 2012 at 06:58 UTC | |
by 2teez (Vicar) on Aug 14, 2012 at 07:06 UTC | |
by Anonymous Monk on Aug 14, 2012 at 07:35 UTC | |
|
Re^2: Global symbol requires explicit package name
by bebe (Novice) on Aug 13, 2012 at 16:59 UTC |