in reply to Re: How to make it work when "use strict;" is on?
in thread How to make it work when "use strict;" is on?

Thanks for your REP
I got these error message:
Variable "$potato" is not imported at E:\perl_script\chp3\typeglob.pl +line 8. Possible unintended interpolation of @potato in string at E:\perl_scri +pt\chp3\typeglob.pl line 9. Variable "@potato" is not imported at E:\perl_script\chp3\typeglob.pl +line 9. Global symbol "$potato" requires explicit package name at E:\perl_scri +pt\chp3\typeglob.pl line 8. Global symbol "@potato" requires explicit package name at E:\perl_scri +pt\chp3\typeglob.pl line 9. Execution of E:\perl_script\chp3\typeglob.pl aborted due to compilatio +n errors.
when I turned off the "use strict;", it worked well...

Replies are listed 'Best First'.
Re^3: How to make it work when "use strict;" is on?
by Corion (Patriarch) on Nov 19, 2014 at 13:15 UTC

    Whoops - in my reply, I gave you the wrong variable names to declare to Perl. You already declare $spud and @spud, but if you want to also use $potato and @potato, you need to also declare theses as global variables. You're using our, so you should declare:

    our $potato; our @potato;

    This will allow the two names to be used.

      It works, thanks!
      #!/usr/bin/perl use warnings; use strict; our $spud="Wow!"; our @spud=qw(idaho russet); our($potato,@potato); *potato=*spud; print $potato; print "@potato"