CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: Re: [francy87] writing array element in a file: Edit Log



FishMonger
Veteran / Moderator

Apr 26, 2013, 9:40 AM


Views: 1253
Re: [francy87] writing array element in a file


Code
my $infile = "rep_set_ass_tax.fna"; 
my $outfile = "seq_id.txt";

open my $in, '<', $infile or die "Can't read $infile: $!\n";
open my $out, '>>', $outfile or die "Can't read $outfile: $!\n";

while (my $line = <$in>) {
print $out "$1\n" if $line =~ /^> (\d+)/;
}
close $in;
close $out;



(This post was edited by FishMonger on Apr 26, 2013, 9:41 AM)


Edit Log:
Post edited by FishMonger (Veteran) on Apr 26, 2013, 9:41 AM
Post edited by FishMonger (Veteran) on Apr 26, 2013, 9:41 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives