Krishna05 has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks! I've just started learning perl yesterday so this is probably newbie question. I'm trying to run the following basic code on Cygwin but it gives me errors.
#!C:\strawberry\perl\bin\perl use strict; use warnings; print "Array Sample \n" my @arrayone = ("String :","Hello","Number :",555); print "$arrayone[0] $arrayone[1]\n"; print "$arrayone[2] $arrayone[3] \n";
This is the error I get
syntax error at testarray.pl line 7, near "my " Global symbol "@arrayone" requires explicit package name at testarray. +pl line 7. Global symbol "@arrayone" requires explicit package name at testarray. +pl line 8. Global symbol "@arrayone" requires explicit package name at testarray. +pl line 8. Global symbol "@arrayone" requires explicit package name at testarray. +pl line 9. Global symbol "@arrayone" requires explicit package name at testarray. +pl line 9. Execution of testarray.pl aborted due to compilation errors.
This works perfectly on my friend's Ubuntu but don't know why am I getting this error on Cygwin.
Ubuntu Virtual OS is very very slow on my Windows 7 so had to go with Cygwin.
Please guide me through if this isn't correct section to post ! Thank you!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Simple perl Code runs on Ubuntu but gives errors on Cygwin
by farang (Chaplain) on Oct 05, 2013 at 02:09 UTC | |
|
Re: Simple perl Code runs on Ubuntu but gives errors on Cygwin
by boftx (Deacon) on Oct 05, 2013 at 02:11 UTC | |
by Krishna05 (Initiate) on Oct 05, 2013 at 02:43 UTC | |
by boftx (Deacon) on Oct 05, 2013 at 02:49 UTC | |
|
Re: Simple perl Code runs on Ubuntu but gives errors on Cygwin
by choroba (Cardinal) on Oct 05, 2013 at 11:16 UTC |