Difference between revisions of "User:Jeongmin Oh"
imported>S m (Creating user page with biography of new user.) |
imported>Jeongmin Oh |
||
Line 1: | Line 1: | ||
− | The | + | <p>#!/usr/bin/perl<br /> |
+ | use strict;<br /> | ||
+ | use warnings;</p> | ||
+ | |||
+ | <p>use Path::Class;<br /> | ||
+ | use autodie; # die if problem reading or writing a file</p> | ||
+ | |||
+ | <p>my $dir = dir("C:/Temp"); # C:/Temp<br /> | ||
+ | print "The Fasta File will be generated in C:/Temp\n";<br /> | ||
+ | print "The name of file is FASTA20131369.txt.\n";<br /> | ||
+ | my $file = $dir->file("file.txt"); # C:/Temp/FASTA20131369.txt</p> | ||
+ | |||
+ | <p># Get a file_handle (IO::File object) you can write to<br /> | ||
+ | my $file_handle = $file->openw();</p> | ||
+ | |||
+ | <p>my @list = ('>Your_first_seq', 'ATATATATATATATATAATATATATATATATATAATATATATATATATATAATATATATATATATATA<br /> | ||
+ | ATATATATATATATATAATATATATATATATATAATATATATATATATATAATATATATATATATATA<br /> | ||
+ | ATATATATATATATATAATATATATATATATATAATATATATATATATATAATATATATATATATATA<br /> | ||
+ | ATATATATATATATATAATATATATATATATATAATATATATATATATATAATATATATATATATATA');</p> | ||
+ | |||
+ | <p>foreach my $line ( @list ) {<br /> | ||
+ | # Add the line to the file<br /> | ||
+ | $file_handle->print($line . "\n");<br /> | ||
+ | }<br /> | ||
+ | </p> |
Latest revision as of 02:07, 4 December 2015
#!/usr/bin/perl
use strict;
use warnings;
use Path::Class;
use autodie; # die if problem reading or writing a file
my $dir = dir("C:/Temp"); # C:/Temp
print "The Fasta File will be generated in C:/Temp\n";
print "The name of file is FASTA20131369.txt.\n";
my $file = $dir->file("file.txt"); # C:/Temp/FASTA20131369.txt
# Get a file_handle (IO::File object) you can write to
my $file_handle = $file->openw();
my @list = ('>Your_first_seq', 'ATATATATATATATATAATATATATATATATATAATATATATATATATATAATATATATATATATATA
ATATATATATATATATAATATATATATATATATAATATATATATATATATAATATATATATATATATA
ATATATATATATATATAATATATATATATATATAATATATATATATATATAATATATATATATATATA
ATATATATATATATATAATATATATATATATATAATATATATATATATATAATATATATATATATATA');
foreach my $line ( @list ) {
# Add the line to the file
$file_handle->print($line . "\n");
}