Learn PERL Basic with Me : How to Store Data and Write it to a File

Reading and writing a file with data is a common practice in Bioinformatics. So in this tutorial we will learn to collect the user input and store them in file. So first we will collect the data one by one then we will write them to another file. For convenience I have added the comments in PERL script
#!/usr/local/bin/perl


# This line will ask for your name
print "What is your name?? \n";

# This line will store your entree as $question1
$question1 = <>;

# This line will make a file 'result.txt' 
open (OUT, ">result.txt");

# This line will ask for your city name
print "In what city do you live???\n";

# This line will store your entree as $question2
$question2 = <>;


# This line will ask for your hobbies
print "What is one of your hobbies?\n";


# This line will store your entree as $question3
$question3 = <>;

# This line will store all your answer into @answer
@answer = ($question1, $question2, $question3);


# This line will print all your answer into file 'result.txt' 
print (OUT @answer );

  • How to Filter the Sequence by Their Length HERE
  • How to extract multiple sequence from a file HERE
  • No comments:

    Post a Comment

    Have Problem ?? Drop a comments here!