Re: Dynamically creating a hash for keys()

2004-10-19 Thread Aaron J. Mackey
follows... print( keys( %{ reverse( %hash ) } ) ); ... but got no results at all. Help! -- Aaron J. Mackey, Ph.D. Dept. of Biology, Goddard 212 University of Pennsylvania email: [EMAIL PROTECTED] 415 S. University Avenue office: 215-898-1205 Philadelphia, PA 19104-6017 fax:215-746-6697

Re: unhead

2004-09-24 Thread Aaron J. Mackey
want to print a file, but without the first N lines... For N=1, one possibility would be: print if $. - 1; For any N, maybe this: print if ($N+1)..0; Any thoughts? Any other ideas? What would be the best way to do this? Regards, jac -- José Alves de Castro <[EMAIL PROTECTED]> http://natur

Re: pattern finding problem

2004-03-17 Thread Aaron J. Mackey
I haven't yet had the chance to thoroughly test and Benchmark this vs. Ron Kimball's solution, so there's no summary yet to report (beside the fact that you and Ron Kimball both provided apparently reasonable solutions). I will also, as originally promised, package the "winning" solution into

Re: pattern finding problem

2004-03-02 Thread Aaron J. Mackey
On Mar 2, 2004, at 9:37 AM, Jeff Abrahamson wrote: Do you allow overlapping patterns? For example, if you are looking for 1212, does the following string contain three instances or only two? 12121212 Yes, three. Do you allow intervening characters? Searching for 12, do you match on this?

pattern finding problem

2004-03-02 Thread Aaron J. Mackey
On the BioPerl mailing list we often get requests like the following: Within a given biosequence with length X, find substrings of min. length A and max. length B that contain the pattern P at least C times but no more than D times. A more concrete example: Find all substrings 12 characters lon

correctly rebuilding a whitespace-split string

2002-10-14 Thread Aaron J Mackey
Someone have a more "perlish", elegant, or just plain faster way of doing something like this: split a string on white space, pop off the last 4 fields (perhaps to be used elsewhere), and then "rebuild" the original string with the correct amount of intervening whitespace. One method: $_ = ; @d

a little shorter please?

2002-07-22 Thread Aaron J Mackey
I can't seem to get this any shorter: I want the second through the next-to-last elements of @F joined by " ", and then the last item of @F. perl -ape '$,=" ";s//>@F[1..$#F-1]\n$F[$#F]/' or (no join, but same general idea): perl -pe 's/\s+(\S+)$/\n$1/;s/^\S+\s+/>/;' What trick am I missing?

Re: m/(\d+)(a){\1}/ ??

2002-07-12 Thread Aaron J Mackey
atching I might need to do ... } OK, can this be condensed to something simpler (but perhaps still readable?) -Aaron On Fri, 12 Jul 2002, Aaron J Mackey wrote: > $_ = "2aaa"; > @d = s/^(\d+)//; > push @d, m/(a)/ for 1..$d[0]; > > My "real" application is s

Re: m/(\d+)(a){\1}/ ??

2002-07-12 Thread Aaron J Mackey
On Fri, 12 Jul 2002, Eugene van der Pijll wrote: > The parentheses around a return only one match, regardless of the number > within the {}. Ahh, right. Sigh, I need to do a limited m//g type of thing, so I guess I'm stuck with something like: $_ = "2aaa"; @d = s/^(\d+)//; push @d, m/(a)/ for

m/(\d+)(a){\1}/ ??

2002-07-12 Thread Aaron J Mackey
$_ = "2aaa"; @d = m/(\d+)(a){\1}/; # @d = (2, a, a); That construct doesn't seem to work; Is there a way to get it to work? Is there an idiom that doesn't involve two passes, i.e. something other than: ($d) = m/(\d+)/; @d = ($d, m/(a){$d}/); Thanks, -Aaron -- Aar

Re: The Santa Claus Golf Apocalypse

2001-12-03 Thread Aaron J Mackey
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Mon, 3 Dec 2001 [EMAIL PROTECTED] wrote: > Like Ian Phillipps, I am in awe of this leading bunch. > This is a hot race. I am really enjoying looking at > the incredible variety of solutions and learning a > lot too. Hopefully there will be a rec

Re: pretty printing sql (fwd)

2001-07-17 Thread Aaron J Mackey
perl, BN, Parse:RecDescent ... FWP!! > > Any hints? Golf? > > a > > Andy Bach, Sys. Mangler > Internet: [EMAIL PROTECTED]VOICE: (608) 264-5178 ex 5738, FAX 264-510 > > So, the Buddha walks into a pizza parlor and says, > "Make me one