Simple Issues with Pod (on verbose and help page without param).

2006-04-03 Thread Edward WIJAYA
=head1 OPTIONS =over 8 =item B<-help> Print a brief help message and exits. =item B<-man> Prints the manual page and exits. =back =head1 DESCRIPTION B will read the given input file(s) and do someting useful with the contents thereof. =cut -- Regards, Edward WIJAYA SINGAPOR

Fast way to find neighboring strings ( wth Hamming Distance)

2006-03-02 Thread Edward WIJAYA
$source =~ /(\[.*?\]|.)/g ); my $mismatch_count = scalar grep substr( $target, $_, 1 ) !~ /^$sparts[$_]/, 0 .. $#sparts; return ( $mismatch_count, scalar(@sparts) ); } sub enum { return @{ $_[1] } unless --$_[0]; map { my $nuc = $_; map { $nuc .

Re: Hash '... => +{ ...' synatx

2005-12-10 Thread Edward WIJAYA
There's probably no need for the plus in that case (after a =>) -- Regards, Edward WIJAYA SINGAPORE -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: Run *.pl file from Emacs

2005-12-09 Thread Edward WIJAYA
On Fri, 09 Dec 2005 19:46:56 +0800, Andrej Kastrin <[EMAIL PROTECTED]> wrote: but is there any solution to run it too. ESC-X path/to/executable or other alternative is to run it under "e-shell" accessible through CTRL-C-D. -- Regards, Edward WIJAYA SINGAPORE -- To uns

Replacing a Bracketed String with "N"

2005-11-22 Thread Edward Wijaya
, and number of strings enclosed by the bracket can consist up to 4 bases, i.e. [ATCG]. -- Regards, Edward WIJAYA SINGAPORE -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: chomp and chop

2005-11-16 Thread Edward WIJAYA
cific (like \r). To view the hidden string you can use this command: cat -A filename.txt Then in Perl you can remove them using regex: sub remove_trailing_newline { $_[0] =~ s/[\r\n]+\Z//; } Hope that helps. -- Regards, Edward WIJAYA SINGAPORE -- To unsubscribe, e-mail: [EMAIL PRO

Input Example Errata -- How to put brackets ....

2005-10-28 Thread Edward WIJAYA
Dear John, Just small correction in the input sample. my @ar5 = qw(GTATG-4 TGGGT-1); should be this: my @ar5 = qw(GTATG-4 TGGGT-7); In short they are already ordered. -- Regards, Edward WIJAYA SINGAPORE -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL

Re: How to put brackets in a string given substrings

2005-10-28 Thread Edward WIJAYA
s/i ) { $id += $-[ 0 ]; substr( $str, $id, length $subs ) =~ tr/A-Z/a-z/; } } $str =~ s/([a-z]+)/[\U$1\E]/g; return $str; } print "\n"; __END__ -- Regards, Edward WIJAYA SINGAPORE On Fri, 28 Oct 2005 18:42:11 +0800, John W. Krah

Enlisting All Possible Ranges of An Array

2005-10-25 Thread Edward Wijaya
'BCDE', 'CD', 'CDE', 'DE' ]; Later, I also want to extend this to deal with AoA as an input. But with the same concept. Is there an efficient way to achieve it? I truly do not know how to go about

Re: perl equivalent of ps

2005-10-16 Thread Edward WIJAYA
ample snippet to measure total memory used up with our script. Hope that helps. -- Regards, Edward WIJAYA SINGAPORE -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: dereferencing

2005-08-24 Thread Edward WIJAYA
quot;Array Size: $asize\n"; print Dumper $aref;' Prints: Array Size: 3 $VAR1 = [ 1, 2, [ 'a', 'b', 'c', 'd' ] ]; -- Regards, Edward WIJAYA SINGAPORE -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Remembering Positions in Array after processing the element

2005-07-29 Thread Edward WIJAYA
x27;,'*'); # returns: ['AB', 'BA','CB','*'] my @array3 = ('A','B','C','D'); # returns: ['AB', 'BA', 'CB','DC'] my @result = get_array(@array); print Dumper [EMAIL PR

Re: perl newbie question

2005-07-25 Thread Edward WIJAYA
erl -e ' open FH, "; close FH or die $!; foreach $i (($#lines - $n) .. $#lines) { print "$lines[$i]\n";} ' -- Regards, Edward WIJAYA SINGAPORE -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: How do I get a Hash name after passing the ref?

2005-07-04 Thread Edward WIJAYA
On Mon, 04 Jul 2005 17:31:03 +0800, Tielman Koekemoer (TNE) <[EMAIL PROTECTED]> wrote: After I passed a hash ref to a subroutine, how can I see what the hash name was? i.e.: I don't think that's possible. Why do you need that? -- Regards, Edward WIJAYA SINGAPORE -- To uns

Re: Tabular Data, Group By Functions

2005-06-14 Thread Edward WIJAYA
Day by IN\n"; print Dumper \%group_day_in ; print "Group Day by Out\n"; print Dumper \%group_day_out ; __DATA__ ID In Out Day 1 5 2 1 2 4 9 2 3 3 3 2 4 6 7 3 5 5 0 5 6 7 9 3 7 8 9 4 8 6 6 4 -- Regards, Edward WIJAYA SINGAPORE -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: columnwise analysis

2005-05-13 Thread Edward WIJAYA
Dumper; my %hash; my $sub_length = 2; while () { chomp; for my $j (0 .. length - $sub_length) { push @{$hash{$j}}, substr $_, $j, $sub_length; } } print Dumper \%hash; foreach my $hkey (keys %hash) { foreach my $i ( 0 .. $#{ $hash{$hkey} } ) { print "$hash{$hkey}[$i]

Re: about substring

2005-05-09 Thread Edward WIJAYA
After second thought This line: my @y = grep { $_ if ($_ =~ /\d+/)} @list; could be simplified with this: my @y = grep { /\d+/ } split(/\s+/,$file); Since grep { $_ if /\d+/ } wouldn't match on 0, but grep /\d+/ would. I'm still wondering how can I do that with "unpack" :-

Re: about substring

2005-05-09 Thread Edward WIJAYA
=~ /\d+/)} @list; print Dumper [EMAIL PROTECTED]; __END__ Gives: $VAR1 = [ '12', '1', '12.435', '13.66', '34.6', '32.1', '32' ]; Hope that's what yo w

Re: Where will I find perl scripts

2005-05-07 Thread Edward WIJAYA
Charles, On Sat, 7 May 2005 14:50:37 -0500, Charles K. Clarkson <[EMAIL PROTECTED]> wrote: plain scary. (Wait, I think _she_ wrote that module, too. Just stay away from _her_. :) _HE_ you mean! :-) http://www.abigail.nl/ -- Regards, Edward WIJAYA Singapore -- To unsubscribe, e-mail:

Howto Dynamically Combine Multiple Array in HoA

2005-05-03 Thread Edward WIJAYA
with single key for my $key (keys %hoa ) { $new_hoa{$key} = $hoa{$key}; } # This is an idiot way (manual) to do it and it's not dynamic # i.e. only satisfy for %set_hoa1 # How can I construct automatically so that it may apply to va

Re: DFA::Simple

2005-04-25 Thread Edward Wijaya
--- Alex Lisbaron <[EMAIL PROTECTED]> wrote: > How can I install this package on WIN2K? Use PPM, like: dos-prompt> ppm then ppm> install DFA-Simple --- Regards, Edward WIJAYA SINGAPORE -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL P

Re: Measuring Substring with Hash

2005-04-08 Thread Edward Wijaya
_score; my $offset = 0; [snip] my $idx = index($str, $frag, $offset) + 1; [snip] $offset = $idx; Don't mean to nitpick. Just wondering if it's possible to modify Krahn's snippet to accomodate the overlapping cases? yet another fans request ;-) -- Edward WIJAYA Singap

Measuring Substring with Hash

2005-04-08 Thread Edward Wijaya
my $idx = index($str, $frag) + 1; for my $pos ($idx .. $idx + (length($frag) - 1)) { $position_score{$pos} = 1; }; }; my $total_score = 0; for my $score (values %position_score) { $total_score += $score; }; return $total_score; }; __END__ -- Edward WIJAY

Re: ideintifying whether a module is already installed or not

2005-03-27 Thread Edward Wijaya
On Sun, 27 Mar 2005 20:28:42 +0800, Manish Sapariya <[EMAIL PROTECTED]> wrote: Hi list, Hi How do I know whether a given module is installed on machine or not? perl -MModule::Name -e 'print "it is installed\n";' or it's simpler variant perl -MModule::Name -e1

Re: How can I get Inline::C to deal with big number?

2005-03-26 Thread Edward Wijaya
Dear Steven, Sorry, don't mean to nitpick. On Sat, 26 Mar 2005 23:09:26 +0800, Steven Schubiger <[EMAIL PROTECTED]> wrote: On 26 Mar, Edward Wijaya wrote: It's fine, as it is. Typedefs most often reside in header files, although, they can be used in the main file without suf

Re: How can I get Inline::C to deal with big number?

2005-03-26 Thread Edward Wijaya
int j; y = x = xx; tmp= x+5.5; tmp -= (x+0.5)*log(tmp); ser=1.0190015; for (j=0;j<=5;j++) ser += cof[j]/++y; return -tmp+log(2.5066282746310005*ser/x); } -- Edward WIJAYA Singapore -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTE

Re: How can I get Inline::C to deal with big number?

2005-03-26 Thread Edward Wijaya
Hi Steven, On Sat, 26 Mar 2005 22:08:44 +0800, Steven Schubiger <[EMAIL PROTECTED]> wrote: Try "long double" instead, which gives you 10 Bytes and the format char %Lf. Still wont' do. It still return 'inf' for N>500 -- Edward WIJAYA Singapore -- To unsubscr

Re: How can I get Inline::C to deal with big number?

2005-03-26 Thread Edward Wijaya
e around 1000-2000. Any other possibility? -- Edward WIJAYA Singapore -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

How can I get Inline::C to deal with big number?

2005-03-26 Thread Edward Wijaya
-0.5395239384953e-5}; int j; y = x = xx; tmp= x+5.5; tmp -= (x+0.5)*log(tmp); ser=1.0190015; for (j=0;j<=5;j++) ser += cof[j]/++y; return -tmp+log(2.5066282746310005*ser/x); } #-End of My Code-- -- Edward WIJAYA Singapore -- To unsubscribe, e-mail: [EMAIL PRO

Re: Taking Multiple Files in Pairs and Run it Iteratively

2005-03-17 Thread Edward Wijaya
On Tue, 15 Mar 2005 02:29:06 +0800, John W. Krahn <[EMAIL PROTECTED]> wrote: Edward Wijaya wrote: [snip] Here is one way to do it: my %files; for ( @ARGV ) { next unless /(.+)\.(?:fa|rs)$/; push @{ $files{ $1 } }, $_; } for my $base ( keys %files ) { if ( @{ $files{

Taking Multiple Files in Pairs and Run it Iteratively

2005-03-13 Thread Edward Wijaya
um (@sum){ print "$sum\n"; } __END__ How can I make my code above such that it can take all multiple files iteratively? to give output sth like this: data1 sum_of_elements from data1.fa and data1.rs data2 sum_of_elements from data2.fa and data2.rs -- Edward WIJAYA Singapore -- To unsubs

Re: Calling Files automatically

2005-02-25 Thread Edward WIJAYA
e directory? For example, will there sometimes be a data14R.fa file and no corresponding data14P.fa file? No, there will always be a corresponding file. i.e. *R.fa always have its *P.fa file Will there be other files located in this directory? Yes, but they won't be any other *R.fa *P.fa type.

Calling Files automatically

2005-02-25 Thread Edward Wijaya
Hi, How can I modify the early part of code below such that I don't have to manually key in the files this way: perl mycode.pl data1P.fa data1R.fa data2P.fa data2R.fa etc I.e. just by typing this will do: perl mycode.pl Thanks so much for your time beforehand. -- Edward WIJAYA Sing

Re: rename all files

2005-02-19 Thread Edward Wijaya
ontents before the directories themselves. BTW your code would have been clear, btw, if you'd said, for example: rename $old, $new or warn "rename: $!\n"; also, "$new = lc $old" is more readable than $new = "\L$old" My suggestion is untested, it'l

Re: Getting the content of a .doc file under Unix

2005-02-14 Thread Edward WIJAYA
/search.cpan.org/~mschwartz/OLE-Storage-0.386/tools/lhalw Of course it's rather outated. HtH -- Regards, Edward WIJAYA Singapore -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Trying mod_perl for the first time

2005-01-26 Thread Edward Wijaya
approach? Hopefully this question is not far off topic. Thanks a lot beforehand. -- Edward WIJAYA Singapore -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Benchmarking a sort with array reference problem

2005-01-21 Thread Edward Wijaya
blem occur. Any idea? Thanks so much beforehand. -- Edward WIJAYA Singapore __BEGIN__ #!/usr/bin/perl -w use strict; use Benchmark 'cmpthese'; my @array = qw(flow loop pool Wolf root sort tour); #The script runs ok if I remove this 'cmpthese' snippet cmpthese (-5, {ra

Re: Extracting and email address

2005-01-21 Thread Edward Wijaya
On Fri, 21 Jan 2005 10:47:33 +, Andrew Black <[EMAIL PROTECTED]> wrote: Is there a module to extract the real email address from a header. e.g. Yes there is "Email::Find" Why would you want to extract email addresses? Spamming? -- Edward WIJAYA Singapore -- To unsubscribe

Re: A second beginner's question

2005-01-15 Thread Edward Wijaya
On Fri, 14 Jan 2005 09:47:50 -0800, John W. Krahn <[EMAIL PROTECTED]> wrote: Perl has a FAQ on shuffling, have you read that yet? perldoc -q shuffle or use CPAN module: List::Util it has a built in *shuffle* function. -- Edward WIJAYA Singapore -- To unsubscribe, e-mail: [EMAIL PROTECTE

Re: Choosing between Regexp and Substr

2005-01-06 Thread Edward Wijaya
_distance_jkrahn1 { my $ret = ( $_[0] ^ $_[1] ) =~ tr/\0//; $ret } sub hamming_distance_jkrahn2 { my $ret = () = ( $_[0] ^ $_[1] ) =~ /\0/g; $ret } __END__ -- Edward WIJAYA Singapore -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: Choosing between Regexp and Substr

2005-01-03 Thread Edward Wijaya
etween these two? sub hamming_distance_string { ( $_[0] ^ $_[1] ) =~ tr/\0// } sub hamming_distance_string { () = ( $_[0] ^ $_[1] ) =~ /\0/g } PS: Thanks to Ted and Jenda for the response as well. -- Edward WIJAYA Singapore -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [E

Choosing between Regexp and Substr

2005-01-02 Thread Edward WIJAYA
Thanks so much for your time. And wishing you all a very Happy and Prosperous New Year 2005! -- Regards, Edward WIJAYA Singapore -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: How to install Tk.pm,LWP.pm?

2004-12-15 Thread Edward WIJAYA
e State: Dos> PPM then: ppm> install Module-Name HtH -- Regards, Edward WIJAYA Singapore -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: basic search engine

2004-12-15 Thread Edward WIJAYA
/search.cpan.org/dist/Plucene/lib/Plucene.pm It is a search engine in itself. HtH -- Regards, Edward WIJAYA Singapore -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: receiving input from different sources

2004-12-14 Thread Edward WIJAYA
t::Long perldoc Getopt::Std Show us some script, so we can see the problem in more concrete ways. -- Regards, Edward WIJAYA Singapore -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: Currency Conversions

2004-12-10 Thread Edward WIJAYA
many. Like: http://search.cpan.org/~barbie/Finance-Currency-Convert-XE-0.06/lib/Finance/Currency/Convert/XE.pm OR http://search.cpan.org/~janw/Finance-Currency-Convert-1.04/Convert.pm -- Regards, Edward WIJAYA Singapore -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail:

Re: looking a one liner "to return the value while clearing the argument"

2004-12-10 Thread Edward WIJAYA
def; in the code? -- Regards, Edward WIJAYA Singapore -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: Good examples of POD for newbies?

2004-12-09 Thread Edward Wijaya
?class=node_link;node_id=252477 Regards, Edward WIJAYA SINGAPORE -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: I am looking for a free perl compiler.

2004-12-08 Thread Edward WIJAYA
to look at CPAN's "PAR" module: http://search.cpan.org/search?mode=module&query=PAR -- Regards, Edward WIJAYA Singapore -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: removing line from a file

2004-12-02 Thread Edward WIJAYA
(makes backup if extension supplied) Your one liner would look like: perl -ne 'print unless /perl/' -ibak FILENAME Glad I learnt yet another One-Liner. -- Regards, Edward WIJAYA SINGAPORE -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://

Re: removing line from a file

2004-12-02 Thread Edward WIJAYA
e : $!"; while() { print FD $_ unless ($_=~/perl/); } close FD; -- Regards, Edward WIJAYA SINGAPORE -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: Learn 2 languages

2004-12-02 Thread Edward WIJAYA
them (maybe except the OO part). However eventually it boils down to right tool for right job. Perl is for its ease of use (and many more!) and C++ is chosen for for speed. -- Regards, Edward WIJAYA -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTE

the case of "-pe" and "-ne" swtich in Perl one liner

2004-12-02 Thread Edward WIJAYA
the case where we *only* need '-ne' ? -- Regards, Edward WIJAYA SINGAPORE -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: Passing hashes as parameters to construct objects

2004-12-01 Thread Edward Wijaya
y passing a hash reference? Any function, including new() can take parameters as an array or a hash, then it can do whatever it wants with the hash, values, just like it would with array values Please also refer to Damian Conway's "Object Oriented Perl", a very good introduction to wh

Re: sorting with Swartz Transform

2004-11-28 Thread Edward WIJAYA
A very good lesson to learn Schwartzian Transform. Thanks Gunnar! -- Regards, Edward WIJAYA SINGAPORE On Sun, 28 Nov 2004 09:36:26 +0100, Gunnar Hjalmarsson <[EMAIL PROTECTED]> wrote: I have code the performs the task, but it's a Swartzian Transform, a temporary array, ano

Re: Perl cant add up with sprintf ?

2004-11-25 Thread Edward WIJAYA
ber, whether perl stored it as signed, unsigned, or floating point" So I guess your best bet is to use: %f though that doesn't give as much precision as %d/%u on some platforms/ HtH -- Regards, Edward WIJAYA SINGAPORE -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional c

Re: How to finding sting in an array

2004-11-17 Thread Edward WIJAYA
in perldoc? Seems most of my questions are FAQs too... - B -- Regards, Edward WIJAYA SINGAPORE -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: How to finding sting in an array

2004-11-17 Thread Edward WIJAYA
for (@myarray) { print 'Yes it exists' and last if $mystring eq $_; } Thanks so much guys. Glad I learnt those... -- Regards, Edward WIJAYA SINGAPORE -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: How to finding sting in an array

2004-11-17 Thread Edward WIJAYA
On Wed, 17 Nov 2004 16:35:58 +0530, Prasanna Kothari <[EMAIL PROTECTED]> wrote: try using grep function. perldoc -f grep Yes correct, didn't think of that before. @exist_elems = grep {/$mystring/} @array_orgn; #note this is untested -- Regards, Edward WIJAYA SINGAPORE -- To uns

Re: How to finding sting in an array

2004-11-17 Thread Edward WIJAYA
Thank You Mauro -- Regards, Edward WIJAYA SINGAPORE -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: Accessing elements of an array passed by reference

2004-11-15 Thread Edward Wijaya
orked automatically } alternatively you can assign a variable after foreach: foreach my $var ( @$deployList ){ print "$var\n"; } Please read- perldoc perlreftut perldoc perlvar for additional info on those issues. HoH Regards, Edward WIJAYA SINGAPORE -- To unsubscribe,

Best place to put collection of subroutines in a program

2004-11-09 Thread Edward WIJAYA
Hi, Would like to know, where is the best place to put collection of subroutines in a Perl program, is it after "main" or before? Any caveat? -- Regards, Edward WIJAYA SINGAPORE -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://l

Re: how to pass array and variable

2004-11-09 Thread Edward WIJAYA
=en&lr=&threadm=opscakjbrtq79b6q%40mailhost.i2r.a-star.edu.sg&rnum=20&prev=/groups%3Fq%3Dedward%2Bwijaya%26start%3D10%26hl%3Den%26lr%3D%26group%3Dperl.beginners.*%26selm%3Dopscakjbrtq79b6q%2540mailhost.i2r.a-star.edu.sg%26rnum%3D20 Regards, Edward WIJAYA SINGAPORE -- To unsubscribe, e-mail:

Re: simple hash question

2004-11-08 Thread Edward Wijaya
use Tie::IxHash module from CPAN, to preserve order in a Hash. Regards, Edward WIJAYA SINGAPORE On Tue, 09 Nov 2004 03:06:03 +0800, Edward Wijaya <[EMAIL PROTECTED]> wrote: On Mon, 8 Nov 2004 11:59:13 +0100, Ing. Branislav Gerzo <[EMAIL PROTECTED]> wrote: Hi pals, I have simple h

Re: simple hash question

2004-11-08 Thread Edward Wijaya
On Mon, 8 Nov 2004 11:59:13 +0100, Ing. Branislav Gerzo <[EMAIL PROTECTED]> wrote: Hi pals, I have simple hash question, lets we have example code: my %hash = ( 1 => 2, 2 => 3, 3 => 4, 4 => 5 ); while (my($key, $value) = each(%hash)) { print "$key => $value\n"; } how I can print all values, if I

Installing modules in Windows through -MCPAN and "nmake" problem

2004-11-07 Thread Edward WIJAYA
nning make install make test had returned bad status, won't install without force - Even if I use "force install" I will still encounter the same message Please advice how can I solve this. Thanks so much for your time. -- Regards, Edward WIJAYA

Re: Getting perl to work on windows 98 se

2004-11-06 Thread Edward Wijaya
help. As adviced ANY help is very much welcome. Thank you very much for all of your time and effort. No problem. Regards, Edward WIJAYA SINGAPORE __ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com -- To unsubscribe, e-mail:

Re: how to pass array and varaible

2004-11-05 Thread Edward Wijaya
sub mysub { my ($var, @array) = @_; my @new_array = (); #do sth to @array or $var; return @new_array; } read - perldoc perlsub Regards, Edward WIJAYA On Sat, 6 Nov 2004 12:48:26 +0530, Anish Kumar K. <[EMAIL PROTECTED]> wrote: Hi I want to pass a array and

Re: Populating HASH from file

2004-10-25 Thread Edward WIJAYA
Hi, Mine is not as elegant as J.Krahn's or Jeff's. But it's an alternative. I am just glad to contribute at least something to the forum I have owed so much... -- Regards, Edward WIJAYA SINGAPORE --- use strict; use warnings; use Data::Dumper; my %h

Re: Howto reverse SortByValue with Tie::IxHash

2004-10-02 Thread Edward Wijaya
;SortByValue()->Keys() ); Thanks so much for your explanation and understanding, Clark. I get it now. Also thanks for your correction, Gunnar. I know I've been rather annoying to you guys lately...Thanks for bearing with it ... :-) I will keep it mind your suggestions. Gratefuly yours, Edward WI

Howto reverse SortByValue with Tie::IxHash

2004-10-02 Thread Edward Wijaya
x27;2-2' => 1, '1-2' => 6, '1-3' => 3 ); my $t = Tie::IxHash->new(%hash); $t->SortByValue; # ascending, ok! $t->$hash{$b}<=>$hash{$a}SortByValue; #tried this but doesn't work __END__ Can anybody advice how to go about t

Re: Problem with subroutines with hash and var as input

2004-10-02 Thread Edward Wijaya
On Sat, 02 Oct 2004 01:46:01 -0700, John W. Krahn <[EMAIL PROTECTED]> wrote: there is an extra $ in there, it should be: 67: delete $HoH->{ $k } if keys %{ $HoH->{ $k } } < $limit; Thanks a lot John. Now it's ok. RegardS, Edward WIJAYA SINGAPORE -- To unsubscribe, e-ma

Re: Problem with subroutines with hash and var as input

2004-10-01 Thread Edward Wijaya
ot a SCALAR reference at testcode.pl line 67. Regards, Edward WIJAYA SINGAPORE -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: Problem with subroutines with hash and var as input

2004-10-01 Thread Edward Wijaya
h pass by reference my ($HoH,$limit) = @_; foreach my $k ( keys %$HoH ) { # This two don't work delete $HoH{ $k } if keys %${ $HoH{ $k } } < $limit;# What's wrong with my deref? } return %HoH; What's wrong with my deref? Regards

Re: How to accumulate Hashes of Array value with the same key?

2004-10-01 Thread Edward Wijaya
On Fri, 1 Oct 2004 10:51:50 -0400, Dave Gray <[EMAIL PROTECTED]> wrote: $HoA = ( key1 => [ ['A',1], ['B',2], ['C',3] ]); Which is clunky when you want to detect duplicates, which is why I suggested the hash. I think you are right Dave. I will follow your s

Problem with subroutines with hash and var as input

2004-10-01 Thread Edward Wijaya
= reduce_hash(%hoh,3); it should return my %hoh = ( key2 => {A => 'foo', B => 'bar', C => 'qux'}, ); But my subroutine doesn't work as it should. Is there anything wrong with it? Yours again, Edward WIJAYA SI

Re: How to accumulate Hashes of Array value with the same key?

2004-10-01 Thread Edward Wijaya
'key1' => [ 'A', 1, 'B', 2, 'C', 2 ] }; not; $VAR1 = { 'key1' => ['

Re: How to accumulate Hashes of Array value with the same key?

2004-10-01 Thread Edward Wijaya
bigger question. Can you give us some more background info? What I am trying to do is to accumulate, every new HoA generated into existing HoA, and join the values if they have the same key. Dave Regards, Edward WIJAYA SINGAPORE -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands

How to accumulate Hashes of Array value with the same key?

2004-09-30 Thread Edward Wijaya
;,2]); namely accumulating the value of HoA2,HoA3 into HoA. Thanks very much for the time. Regards, Edward WIJAYA SINGAPORE -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: Problem iterating over diamond (while)

2004-09-29 Thread Edward Wijaya
On 29 Sep 2004 14:06:33 -, Peter Scott <[EMAIL PROTECTED]> wrote: Nitpick - the "diamond operator" is <>. would be use of the "readline operator". Thanks for making it precise Peter. Glad that I learnt that. Forgive me for my limited Perl vocabulary. Regard

Re: How to access first key of "Hash of Hash"

2004-09-29 Thread Edward Wijaya
On 29 Sep 2004 15:20:39 +0100, Jose Alves de Castro <[EMAIL PROTECTED]> wrote: for (keys %HoH) { print "$_\n"; } It seems so. Thanks a lot. I thought 'keys' are only for simple hash. Regards, Edward WIJAYA SINGAPORE -- To unsubscribe, e-mail: [EMAIL PROTECTED] For a

Re: How to access first key of "Hash of Hash"

2004-09-29 Thread Edward Wijaya
secondkey" from $fkey "A, B, C, etc"from $alpha "blabla etc" from $text my question is how can I print output like: firstkey secondkey given the construction variables as mention before. Thanks Regards, Edward WIJAYA SINGAPORE -- To

How to access first key of "Hash of Hash"

2004-09-29 Thread Edward Wijaya
" I tried this with no avail: print "$HoH{$fkey}\n" Regards, Edward WIJAYA SINGAPORE -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

How to find if a key exist in hash?

2004-09-29 Thread Edward Wijaya
Hi, I have the following code, and I know it is HORRIBLE. I wonder if I can do it in more efficient and elegant way? Thanks so much and Regards, Edward WIJAYA SINGAPORE __BEGIN__ use strict; use warnings; use Getopt::Std; use Data::Dumper; my %hash = ( A => 'blabla',

Re: Problem iterating over diamond (while)

2004-09-28 Thread Edward Wijaya
Many many thanks Bob! Glad to know I can do it in one-line. for ( ...blah... ) { seek(INFILE, 0, 0); # <--- rewind file back to start while () {... } } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Problem iterating over diamond (while)

2004-09-28 Thread Edward Wijaya
'reopen'. Doesn't seem to work as well. __BEGIN__ for ( my $t = 1 ; $t <= $trial ; $t++ ) { print "Trial ", $t, "\n"; while () { print;} } close INFILE; open INFILE; #is this how you reopen? __END__ Hope you don't mind to elab

Problem iterating over diamond (while)

2004-09-28 Thread Edward Wijaya
ase kindly advice how can I overcome this problem. Thanks so much for your time. Regards, Edward WIJAYA SINGAPORE __BEGIN__ use strict; use warnings; use Getopt::Std; our $opt_f; getopts('f:'); open INFILE, "<$opt_f" or die "$0: Can't open file $opt_f: $!"; my $

Opening file($ARGV) with Getopt - failing

2004-09-28 Thread Edward Wijaya
Hi, Why my code below fail to open and print the file contents when I do: perl mycode.pl -f filename Regards, Edward WIJAYA SINGAPORE __BEGIN__ use strict; use warnings; use Getopt::Std; use vars qw($f); getopts('f:'); my $f = $ARGV[0]; open ( INFILE, '<', $f) or d

How to return 'k'-cliques in a graph

2004-09-24 Thread Edward WIJAYA
de below only return the "last" k-clique found. My question is how can I modify my code below so it can store and then returns all the "k-clique" found? That is: $ perl graph.pl 3 would give: 1 2 3 1 2 4 1 3 4 2 3 4 5 6 9 Thanks so much for your time. Regards, Edward WIJAYA SIN

Re: compare the content of a hash

2004-09-17 Thread Edward WIJAYA
! http://vote.yahoo.com -- Regards, Edward WIJAYA SINGAPORE -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: String to Numeric of an Array

2004-09-14 Thread Edward WIJAYA
ry to have asked such a trivial question. Regards, Edward WIJAYA SINGAPORE -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

String to Numeric of an Array

2004-09-14 Thread Edward WIJAYA
Hi, How can I change the value of this array: @array = ['1','2','3']; #which contain "string" numeric to @arrayNum = [1,2,3]; #as pure numeric Regards, Edward WIJAY -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: How to dynamically taking the multiple input arguments?

2004-09-10 Thread Edward WIJAYA
whitespace for ( @data ) { s/^\s+//; s/\s+/ /g; s/ $/\n/; } Hope to heare from you again. Regards Edward WIJAYA -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

How to dynamically taking the multiple input arguments?

2004-09-10 Thread Edward WIJAYA
information about dealing with this matter? Any specific module that cater this problem? Thanks for your time beforehand. Regards, Edward WIJAYA SINGAPORE This is my current (terribly inefficient and unflexible) code: #!/usr/bin/perl -w use strict; use Data::Dumper; if(scalar @ARGV ne 1) { print

Re: Splicing Hash problem - possible with "map"?

2004-09-06 Thread Edward WIJAYA
on? Make it into one-liner? then first you must find the key, or use, say, Tie::Has::Regex from CPAN. I will install that package. Thanks again. Regards, Edward WIJAYA -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Splicing Hash problem

2004-09-06 Thread Edward WIJAYA
;}; and the current becomes: %myhash = { '4 atc' => 'TGCGCatcGA', '5 ctg' => 'AGctgTGTTT', '3 NO MOTIF' => 'TCCGTGCGCT', '2 caa' => 'GAAGcaaGGC' }; Thanks so much for your time. Regards, Edward WIJAYA SINGAPORE -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: Inserting short strings into longer strings -- strncpy in Perl?

2004-09-03 Thread Edward WIJAYA
@array3 indicates the string was to overwrite at a random position. I assume the entire string must be inside the result. Yes, you are right Charles. And thanks so much too for Gunnar and Jeff. Best, Edward WIJAYA SINGAPORE -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands

Where to get Math-TrulyRandom for PPM?

2004-09-03 Thread Edward WIJAYA
Hi, I've tried all the repositories as suggested by Active State documentation, including Jenda's repository. But I always encounter error message "Fail to download..." Hope to hear from you guys again. Regards Edward WIJAYA -- To unsubscribe, e-mail: [EMAIL PROTECTED] For ad

Inserting short strings into longer strings -- strncpy in Perl?

2004-09-02 Thread Edward Wijaya
;); Is there any efficient way to copy each element of @arr2 as part of each elements in @arr1 such that it gives result: @arr3 =('GAtcctctaAAGGAGAGGTACTTACAGG', 'CGCCCAAGAGGCCAGaggccacCA', 'CGTTAAagctgcgAAGTTCT'); #the starting pos

Re: I want to compile my perl code!

2004-08-30 Thread Edward Wijaya
perl -c par.pl On Mon, 30 Aug 2004 15:49:37 +0800, pagoda <[EMAIL PROTECTED]> wrote: I want to compile my perl code, and I tried "perlcc" and "par.pl". I don't know which one is more powerful? It seems that both they are not very good. Give me a hand please. Thanks. -- To unsubscribe, e-mail: [E

  1   2   >