help with perl

V

Vip

I have this problem to solve but i don't know how!

Develop a Perl program that receives as argument on the command line
the name of a file in the working directory (containing one DNA
sequence in FASTA format) and prints the content of the file with the
whole sequence in uppercase character.
-It checks the number of arguments received on the command line and if
the number is not 1 it prints an error message and exits.

Can anyone tell me how to develop this fuctions with perl?
 
J

Jens Thoms Toerring

Vip said:
I have this problem to solve but i don't know how!

Develop a Perl program that receives as argument on the command line
the name of a file in the working directory (containing one DNA
sequence in FASTA format) and prints the content of the file with the
whole sequence in uppercase character.
-It checks the number of arguments received on the command line and if
the number is not 1 it prints an error message and exits.

Homework? And what have you tried so far?
Can anyone tell me how to develop this fuctions with perl?

- Check the number of elements in the command line arguments
array @ARGV, if it's not 1 print an error message and exit.
- Use the open() function to open the file using the first
element of the argument array.
- Read it in line by line (using the '<>' operator) and
- if it's a line with a DNA sequence use the uc() function to
convert all characters to upper case (read the specification
of the FASTA format to figure out how these lines are diffe-
rent from description lines - seems to be trivial)
- print out the line.
- Close the file using the close() function.

Regards, Jens
 
J

Jürgen Exner

Vip said:
Develop a Perl program that receives as argument on the command line

See "perldoc perlvar" and look for @ARGV
the name of a file in the working directory (containing one DNA
sequence in FASTA format) and prints

perldoc - f print
the content of the file

perldoc -f readline
with the
whole sequence in uppercase character.

perldoc -f uc
-It checks the number of arguments received on the command line

perldoc -f scalar
and if
the number is not 1

perldoc perlop
it prints an error message

perldoc -f print
and exits.

perldoc -f exit
Can anyone tell me how to develop this fuctions with perl?

Typically you would use the editor of your choice to write the code,
save it to your hard drive, and test it. Repeat until it does what it is
supposed to do.

jue
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top