Re: [MacPerl-AnyPerl] Sorting a list of alphanumeric strings

2001-08-24 Thread David Iberri
This was my first guess, but I'm sure there are better ways: my @ary = qw(exon1 exon5 exon12 exon30 exon2); @ary = sort by_exon_num @ary; print join("\n", @ary), "\n"; sub by_exon_num { $a =~ /(\d+)/; my $a_dig = $1; $

[MacPerl-AnyPerl] Re: Sorting a list of alphanumeric strings

2001-08-24 Thread David Iberri
> ok, seriously, we'll also assume no two entries have > the same number, and if > they did you'd want to delete repeats. This makes > things a lot easier. > > #! perl > > open FILE, 'file.txt'; > @list = ; # get list into array or by some > other means > # keep the line brea

Re: [MacPerl-AnyPerl] IP Push I Guess ??

2001-11-29 Thread David Iberri
nly output to STDOUT, otherwise the redirection won't occur. Any output from script.pl on will be displayed in the user's browser. Regards, David Iberri on 11/29/2001 5:21 PM, John Murray at [EMAIL PROTECTED] wrote: > If I send a form to a script that the sends back some html, t

[MacPerl-AnyPerl] Multiple Inheritance

2001-12-12 Thread David Iberri
Hi folks, Can anyone point me to some docs relevant to multiple inheritance? I have two base classes A and B, then a derived class C that inherits from A and B. Pretty standard, I think: package A; sub new { my $pkg = shift; return bless { _key1 => 'val1', _key2 => 'val2' }, $pkg; } packa

Re: [MacPerl-AnyPerl] Re: Multiple Inheritance

2001-12-12 Thread David Iberri
Randal L. Schwartz wrote: >>>>>> "David" == David Iberri <[EMAIL PROTECTED]> writes: > > David> Can anyone point me to some docs relevant to multiple inheritance? > > David> I have two base classes A and B, then a derived class C that >

Re: [MacPerl-AnyPerl] symbolic references <-> no strict refs

2002-03-18 Thread David Iberri
Said allan: >> Keary Suska wrote: >> >> IMHO, symbolic refs are syntactic sugar that make code difficult to read, >> follow, and debug. I recommend using hashes or objects instead. They are >> easier to read, follow, and debug, and are more extensible. Not to mention that those extra sigils give

Re: [MacPerl-AnyPerl] sorting by hash value

2002-09-23 Thread David Iberri
$presVocab{$a} cmp $presVocab{$b} } keys %presVocab; foreach my $key(@keys_sorted_by_value) { print "$key => $presVocab{$key}\n"; } Cheers, David Iberri --- allan <[EMAIL PROTECTED]> wrote: > hi > > is it possible to sort by the values in a hash if > those values m

Re: [MacPerl-AnyPerl] reading error_log

2003-01-28 Thread David Iberri
Hi Eelco, This solution requires the File::Tail module available from CPAN (File::Tail, in turn, requires Time::HiRes): use File::Tail; # File to read from my $text_file = '/www/logs/error_log'; # Number of lines to read from end of file my $num_lines = 25; # Create a new File::Tail object sta

Re: [MacPerl-AnyPerl] sort a database

2003-03-02 Thread David Iberri
Hi Eelco, If you're data file isn't excessively large, you might use the following example. Otherwise, you should probably stuff you data file into a database ,such as CSV or mysql, and use the DBI (available at www.cpan.org) for processing. The following code reads in each line of $data_file, re