split the sequences

X

Xicheng

Rita said:
Thanks,But i alredy tried it.it is not working.in output file i am
getting output from this line
print $OUTPUT "Hit Name-$hit_name\tSequence name-$id\n";
But not of this line.
print $OUTPUT;
This statement made some problems, I guess Perl interpolates it as a
scalar variable instead of a filehandle, so it prints null into your
file. I remember I saw a solution somewhere, but I can not remember it
now. Anyway you can try it the following way:

print $OUTPUT $_;

leave a space between $OUTPUT and $_... :)
Good luck
Xicheng
 
J

J. Gleixner

Rita said:
J. Gleixner said:
Rita said:
J. Gleixner wrote:
Rita wrote:
[...]
Is templ.out a file and you want its contents written to result.out?
yes,But It is in loop so every time temp1.out has diffrent output and
i want to store all the output in 'result.out'.
open( my $rpt,'<', 'temp1.out') or die "Can't open temp1.out: $!";
print $OUTPUT "Hit Name-$hit_name\tSequence name-$id\n";
while(<$rpt>) {
print $OUTPUT;
}
close($rpt) or die "Can't close templ.out: $!";
Thanks,But i alredy tried it.it is not working.in output file i am
getting output from this line
print $OUTPUT "Hit Name-$hit_name\tSequence name-$id\n";
But not of this line.

print $OUTPUT;

OK. Now that we have that figured out, what's in templ.out?

Before running the script, remove 'templ.out', it's probably just
hanging around from running the script before. Then just before the
open, simply "exit;". When you're back at the prompt, check what's
in the 'templ.out' file.

It seems like there's nothing in the file. Meaning either it's being
written elsewhere (different directory, or file name) or whatever
you're expecting to create the data, isn't creating any data,
which might mean much more debugging.
 
X

Xicheng

J. Gleixner said:
Rita wrote:

this statement prints:
GLOB(0x8164a34)GLOB(0x8164a34)GLOB(0x8164a34)GLOB(0x8164a34)GLOB(0x8164a34)GLOB(0x8164a34)
GLOB(0x8164a34)GLOB(0x8164a34)GLOB(0x8164a34)

on the STDOUT instead of the file $rpt refers to. that's the problem..

Xicheng
 
X

Xicheng

Xicheng said:
This statement made some problems, I guess Perl interpolates it as a
scalar variable instead of a filehandle, so it prints null into your

this is my mistake, it prints the typeglob reference $OUTPUT to the
STDOUT...

Xicheng
 
J

J. Gleixner

Xicheng said:
this is my mistake, it prints the typeglob reference $OUTPUT to the
STDOUT...

I cut out a little to much. In earlier code, the OP had something like:

open( my $OUTPUT, '>', 'results.out') or die "...";

so it should be OK.
 
R

Rita

Xicheng said:
This statement made some problems, I guess Perl interpolates it as a
scalar variable instead of a filehandle, so it prints null into your
file. I remember I saw a solution somewhere, but I can not remember it
now. Anyway you can try it the following way:

print $OUTPUT $_;

leave a space between $OUTPUT and $_... :)
Thanks ,I tried it and it is working.Thanks to you and all the person
who helps me .
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
SterlingLa
Top