On Wed, 27 Jun 2001, Hans Holtan wrote:
> I get this error when I run my script, and I don't understand why:
>
> "Can't use string ("CHR3") as a symbol ref while "strict refs" in use
> at AtIntergenicTableSort.pl line 53. "
>
> I'm trying to split my output into 5 seperate files based on what is
> in the key. Here is a snip of code:
>
> #Sort the hash and write to a new file
> foreach $k (sort keys (%all_genes)) {
> for (1..5){
> if ($k =~ /[$_]g/){
> $file = "CHR$_";
> print $file ">$k\t$all_genes{$k}\n";
> print ">$k \t $all_genes{$k}\n";
> last;
> }
Looks to me you are trying to print to a file named CHR$_, which you have
not opened, and which Perl is trying to interpret as a symbolic reference
to a filehandle.
-- Brett
http://www.chapelperilous.net/btfwk/
------------------------------------------------------------------------
Fortune's Real-Life Courtroom Quote #52:
Q: What is your name?
A: Ernestine McDowell.
Q: And what is your marital status?
A: Fair.