Hi, as the title, I have an array @f_lines with gene information in it. How can I put the content of @f_lines into a file so that I can read it?
I tried this:
open(OUTPUT, "file"); # put gene information in this file;
@f_lines = ("gene1", "gene2", "gene3"...); # gene information;
print OUTPUT @f_lines;
close(OUTPUT);
I didn't get any warnings, neither did i see gene information in "file".
Does anyone know the problem? Thanks very much for help~
By the way above is part of the script I ran in a shell.
guruprasadpr:
open(OUTPUT, ">file");
Guru.
Yes I did put ">" in. Sorry I forgot to post that.
drl
March 21, 2012, 5:33pm
4
Hi.
This code:
#!/usr/bin/env perl
# @(#) p1 Demonstrate write to file.
use warnings;
use strict;
my (@f_lines);
open( OUTPUT, ">file" ); # put gene information in this file;
@f_lines = ( "gene1", "gene2", "gene3" ); # gene information;
print OUTPUT @f_lines;
close(OUTPUT);
produces:
leap 1224 $ ./p1
leap 1224 $ cat file
gene1gene2gene3leap 1224 $
For this context:
OS, ker|rel, machine: Linux, 2.6.26-2-amd64, x86_64
Distribution : Debian GNU/Linux 5.0.8 (lenny)
perl 5.10.0
You may have missed the line if you didn't include a newline.
Best wishes ... cheers, drl