Open main menu

Biolecture.org β

User:Jeongmin Oh

#!/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");
}