Re: how to count?

2003-06-08 Thread Hans Holtan
Hi Jerry I'm not sure, but maybe this is what you mean: my @IDS = qw (a b c d e f g); my $c=0; foreach my $id (@IDS){ $c++; $id.=$c; print "$id\n"; } # Hans On Sunday, June 8, 2003, at 09:41 PM, Jerry Preston wrote: Hi! I am not sure if this can be done or not, but I want

use Getopt::Std; and use strict;

2002-05-10 Thread Hans Holtan
Hi everyone, I have a problem using Getopt::Std. I depend on use strict for all my code, and when I use Getopt::Std all the variables it creates (to hold the command line option values) are flagged by strict because they have not been scoped. I get errors like this: Line 70: Global symbol "$o

References

2002-04-21 Thread Hans Holtan
Hi folks, The code shown bellow is supposed to de-reference a hash-reference of array-references and print everything out nicely. But the array references do not get de-referenced. I really appreciate the help. Thanks, Hans #!usr/bin/perl -w use strict; use warnings; use diagnostics; my $ali

Re: log file question

2002-04-03 Thread Hans Holtan
Hi Lance, I don't know if this is too general for your purposes, but this should look through a whole file and find anyplace that the word "running" appear in three consecutive lines. open (INFILE, "+; for (0 .. ($#all_lines-2)){ if ( ($all_lines[$_] =~ m/running/gi) a

Re: Question about writing to file

2002-03-28 Thread Hans Holtan
Try removing the newline at the end of your question with a call to chomp. else{ for (my $i=1; $i<=$#qk+1;$i++){ chomp ($Question_hash{$qk[$i-1]}); print In1 "Question"."$i".":factor$Question_hash{$qk[$i-1]}=$Answer_hash{$ak[$i-1]}\n"; } >Here is a subroutine that prints strings to a file.

searching a large file

2002-02-28 Thread Hans Holtan
I am having a problem searching a large (600 mb) text file. What I need to do is find a match with a short bit of text and then look up to 200 characters forwards and backwards for other matches to different short bits of text. I tried reading the file to memory first and then doing the search

finding max value

2002-02-12 Thread Hans Holtan
Hi everyone, I have a set of functions that give numeric results, and I need to compare them and choose the maximal value. Is there any simple way of finding max? Hans -- Hans E. E. Holtan Graduate Student UC Berkeley-Department of Plant and

newbie: relative directory paths not working

2001-07-15 Thread Hans Holtan
Hi everyone, I find that I must use absolute directory paths to access files from my perl scripts. If I just name a file: open (FH, "

using strict - ADDENDUM

2001-06-27 Thread Hans Holtan
Hi everyone, I forgot to mention that I did open the output files earlier in the program, ie CHR1, CHR3 ... CHR5. Here is the whole thing: #!usr/bin/perl -w use strict; my ($input,$output,$k,$v,$gene, $input_string, $output1,$output2,$output3,$output4,$output5, $file, $junk,$i,

using strict

2001-06-27 Thread Hans Holtan
Hi everyone, 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

regex on hash keys?

2001-06-13 Thread Hans Holtan
Hi everyone, I'm a bit green, and I'm trying to split a large file into a hash. My problem is that the parts that I want to use as keys are a bit long (100-200 letters), and I will need to pull them out by the presence of certain substrings later. So my actual question is this, how do I retre