Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > help with perl

Reply
Thread Tools

help with perl

 
 
Vip
Guest
Posts: n/a
 
      01-28-2012
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?
 
Reply With Quote
 
 
 
 
Jens Thoms Toerring
Guest
Posts: n/a
 
      01-28-2012
Vip <(E-Mail Removed)> wrote:
> 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
--
\ Jens Thoms Toerring ___ http://www.velocityreviews.com/forums/(E-Mail Removed)
\__________________________ http://toerring.de
 
Reply With Quote
 
 
 
 
Jürgen Exner
Guest
Posts: n/a
 
      01-28-2012
Vip <(E-Mail Removed)> wrote:
>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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
FAQ 2.17 What is perl.com? Perl Mongers? pm.org? perl.org? cpan.org? PerlFAQ Server Perl Misc 0 04-04-2011 10:00 PM
FAQ 1.4 What are Perl 4, Perl 5, or Perl 6? PerlFAQ Server Perl Misc 0 02-27-2011 11:00 PM
FAQ 2.17 What is perl.com? Perl Mongers? pm.org? perl.org? cpan.org? PerlFAQ Server Perl Misc 0 02-03-2011 11:00 AM
FAQ 1.4 What are Perl 4, Perl 5, or Perl 6? PerlFAQ Server Perl Misc 0 01-23-2011 05:00 AM
Perl Help - Windows Perl script accessing a Unix perl Script dpackwood Perl 3 09-30-2003 02:56 AM



Advertisments