help with perl

Discussion in 'Perl Misc' started by Vip, Jan 28, 2012.

  1. Vip

    Vip Guest

    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?
    Vip, Jan 28, 2012
    #1
    1. Advertising

  2. Vip <> 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://toerring.de
    Jens Thoms Toerring, Jan 28, 2012
    #2
    1. Advertising

  3. Vip <> 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
    Jürgen Exner, Jan 28, 2012
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dpackwood
    Replies:
    3
    Views:
    1,791
  2. PerlFAQ Server

    FAQ 1.4 What are Perl 4, Perl 5, or Perl 6?

    PerlFAQ Server, Jan 23, 2011, in forum: Perl Misc
    Replies:
    0
    Views:
    297
    PerlFAQ Server
    Jan 23, 2011
  3. PerlFAQ Server
    Replies:
    0
    Views:
    677
    PerlFAQ Server
    Feb 3, 2011
  4. PerlFAQ Server

    FAQ 1.4 What are Perl 4, Perl 5, or Perl 6?

    PerlFAQ Server, Feb 27, 2011, in forum: Perl Misc
    Replies:
    0
    Views:
    291
    PerlFAQ Server
    Feb 27, 2011
  5. PerlFAQ Server
    Replies:
    0
    Views:
    679
    PerlFAQ Server
    Apr 4, 2011
Loading...

Share This Page