jon
jon

Reputation: 11366

installing perl in windows 7

I am pretty layman to Perl, never used it ...but now I want to use it.

Here is what I did:

http://www.activestate.com/activeperl/downloads

I installed universal version - 5.12.4.1205

To test my program is working, I used the following small program :

dnacon.plx

#i/Perl64/bin/perl -w 
#Example 1-1 Concatenating DNA 

$DNA1 = 'ATTTGGTAAAATGTATA'
$DNA2 = 'TTTTGGGTTTGAAAT'

print "Here are two DNA fragments: \n\n"
print $DNA1,  "\n\n"
print $DNA2,  "\n\n"

$DNA3 = "$DNA1$$DNA2"
print "$DNA3\n\n

When I try to execute it the following is command prompt with errors.

enter image description here

Sorry for too basic question...

EDTIS:

When I just type dnacon.plx, it is seems that it is working, but with error !!! 

c:\myperllessions>dnacon.plx

Scalar found where operator expected at C:\myperllessions\dnacon.plx line 5, nea
r "$DNA2"
        (Missing semicolon on previous line?)
syntax error at C:\myperllessions\dnacon.plx line 5, near "$DNA2 "
Execution of C:\myperllessions\dnacon.plx aborted due to compilation errors.

Am I good to go ??? What could be the error ...compilation errors ????

Edits:

I am using the following now : is this correct ?

#i/Perl64/bin -w 

Edits:

I changed my script to following:

#i/Perl64/bin -w 
#Example 1-1 Concatenating DNA 
use strict; 
use warnings;
$DNA1 = 'ATTTGGTAAAATGTATA';
$DNA2 = 'TTTTGGGTTTGAAAT';

print "Here are two DNA fragments: \n\n";
print $DNA1,  "\n\n"; 
print $DNA2,  "\n\n"; 

$DNA3 = "$DNA1$$DNA2"; 
print "$DNA3\n\n";

I got the following error:

c:\myperllessions>dnacon.plx

Global symbol "$DNA1" requires explicit package name at C:\myperllessions\dnacon
.plx line 5.
Global symbol "$DNA2" requires explicit package name at C:\myperllessions\dnacon
.plx line 6.
Global symbol "$DNA1" requires explicit package name at C:\myperllessions\dnacon
.plx line 9.
Global symbol "$DNA2" requires explicit package name at C:\myperllessions\dnacon
.plx line 10.
Global symbol "$DNA3" requires explicit package name at C:\myperllessions\dnacon
.plx line 12.
Global symbol "$DNA1" requires explicit package name at C:\myperllessions\dnacon
.plx line 12.
Global symbol "$DNA2" requires explicit package name at C:\myperllessions\dnacon
.plx line 12.
Global symbol "$DNA3" requires explicit package name at C:\myperllessions\dnacon
.plx line 13.
Execution of C:\myperllessions\dnacon.plx aborted due to compilation errors.

Is my problem now with programming knowledge or something to do with installation ?????

Upvotes: 2

Views: 11466

Answers (3)

Unos
Unos

Reputation: 1361

Did you try out Strawberry perl? It takes care of setting up the environment vars for you.

Upvotes: 2

Borodin
Borodin

Reputation: 126722

To get perl to be recognized, you must add C:\Perl64\bin to the PATH environment variable. Go to Control Panel > System > Advanced System Settings > Environment Variables. Edit the line containing PATH in the top box marked User variables for <user>, and add ;C:\Perl64\bin (note the semicolon) to the end. Be sure not to corrupt anything that's already there.

The problems you are left with in your latest edit - Global symbol requires explicit package name - are because you have added use strict (a very good thing to do) and you haven't declared your variables. Also the line #i/Perl64/bin -w won't do anything and may as well be removed. Write this instead

use strict; 
use warnings;

my $DNA1 = 'ATTTGGTAAAATGTATA';
my $DNA2 = 'TTTTGGGTTTGAAAT';

print "Here are two DNA fragments: \n\n";
print $DNA1,  "\n\n"; 
print $DNA2,  "\n\n"; 

my $DNA3 = "$DNA1$$DNA2"; 
print "$DNA3\n\n";

Upvotes: 3

darnir
darnir

Reputation: 5180

An environment variable may not be set up yet. Since I no longer use Windows, I cannot give you the exact step by step instructions, but I can tell you, that somewhere in System Properties, you'll find a place to edit the environment variables. Edit the path variable and append 'C:\Perl64\bin\' to it.

P.S.:This is assuming that when you cd to the said path, you are able to run the perl program. If not, something is wrong with the installation. Try re-installing Perl.

Upvotes: 1

Related Questions