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

2006-04-03 Thread Edward WIJAYA
and exits. =back =head1 DESCRIPTION BThis program will read the given input file(s) and do someting useful with the contents thereof. =cut -- Regards, Edward WIJAYA SINGAPORE -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http

Fast way to find neighboring strings ( wth Hamming Distance)

2006-03-02 Thread Edward WIJAYA
( $target, $_, 1 ) !~ /^$sparts[$_]/, 0 .. $#sparts; return ( $mismatch_count, scalar(@sparts) ); } sub enum { return @{ $_[1] } unless --$_[0]; map { my $nuc = $_; map { $nuc . $_ } @{ $_[1] } } enum( $_[0], $_[1] ); } __END__ -- Regards, Edward WIJAYA

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

2005-12-10 Thread Edward WIJAYA
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 unsubscribe, e-mail

Replacing a Bracketed String with N

2005-11-22 Thread Edward Wijaya
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
). 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 PROTECTED] For additional

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

Enlisting All Possible Ranges of An Array

2005-10-25 Thread Edward Wijaya
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 it. Really hope to hear from you again. -- Regards, Edward WIJAYA SINGAPORE -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional

Re: perl equivalent of ps

2005-10-16 Thread Edward WIJAYA
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
', '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
('returns') for the desired result sub get_array{ my @array = @_; my @result; foreach ( 0 .. $#array-1 ) { my $st = $array[$_+1].$array[$_]; push @result, $st; } return @result; } __END__ Thanks and hope to hear from you again. -- Regards, Edward

Re: perl newbie question

2005-07-25 Thread Edward WIJAYA
or die $!; @lines = 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

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 unsubscribe, e-mail

Re: Tabular Data, Group By Functions

2005-06-14 Thread Edward WIJAYA
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-14 Thread Edward WIJAYA
) { 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]; # or do some regex with it } } __DATA__ ABDC EFGH -- Regards, Edward WIJAYA SINGAPORE

Re: about substring

2005-05-09 Thread Edward WIJAYA
Dumper [EMAIL PROTECTED]; __END__ Gives: $VAR1 = [ '12', '1', '12.435', '13.66', '34.6', '32.1', '32' ]; Hope that's what yo wanted. -- Regards, Edward WIJAYA SINGAPORE -- To unsubscribe, e-mail: [EMAIL PROTECTED

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 :-( -- Regards, Edward WIJAYA

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: [EMAIL

Howto Dynamically Combine Multiple Array in HoA

2005-05-03 Thread Edward WIJAYA
]; return %new_hoa; } __END__ 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: 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 PROTECTED] http

Measuring Substring with Hash

2005-04-08 Thread Edward Wijaya
)) { $position_score{$pos} = 1; }; }; my $total_score = 0; for my $score (values %position_score) { $total_score += $score; }; return $total_score; }; __END__ -- Edward WIJAYA Singapore -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL

Re: Measuring Substring with Hash

2005-04-08 Thread Edward Wijaya
, $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 Singapore -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail

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 Hth -- Edward WIJAYA Singapore

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 PROTECTED

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

2005-03-26 Thread Edward Wijaya
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

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 N500 -- Edward WIJAYA Singapore -- To unsubscribe, e-mail: [EMAIL PROTECTED

Re: 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); } -- Edward WIJAYA Singapore -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail

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 suffer. As per your

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{ $base

Taking Multiple Files in Pairs and Run it Iteratively

2005-03-13 Thread Edward Wijaya
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 unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http

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 Singapore

Re: Calling Files automatically

2005-02-25 Thread Edward WIJAYA
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. Charles K. Clarkson -- Regards, Edward WIJAYA

Re: rename all files

2005-02-19 Thread Edward Wijaya
. 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'll be nice if you let us know if it works ;-) HtH -- Edward WIJAYA Singapore -- To unsubscribe, e

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

2005-02-14 Thread Edward WIJAYA
/~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
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

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, e-mail: [EMAIL

Benchmarking a sort with array reference problem

2005-01-21 Thread Edward Wijaya
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, {rad = radix_sort([EMAIL PROTECTED

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 PROTECTED

Re: Choosing between Regexp and Substr

2005-01-06 Thread Edward Wijaya
] ) =~ /\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
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: [EMAIL PROTECTED] http

Choosing between Regexp and Substr

2005-01-02 Thread Edward WIJAYA
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: basic search engine

2004-12-15 Thread Edward WIJAYA
/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: How to install Tk.pm,LWP.pm?

2004-12-15 Thread Edward WIJAYA
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: receiving input from different sources

2004-12-14 Thread Edward WIJAYA
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: looking a one liner to return the value while clearing the argument

2004-12-10 Thread Edward WIJAYA
? -- 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
://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: [EMAIL PROTECTED] http

Re: Good examples of POD for newbies?

2004-12-09 Thread Edward Wijaya
=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
at CPAN's PAR module: http://search.cpan.org/search?mode=modulequery=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

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

2004-12-02 Thread Edward WIJAYA
' ? -- 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
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 PROTECTED] http://learn.perl.org

Re: removing line from a file

2004-12-02 Thread Edward WIJAYA
$_ 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: removing line from a file

2004-12-02 Thread Edward WIJAYA
) 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://learn.perl.org/ http://learn.perl.org/first

Re: Passing hashes as parameters to construct objects

2004-12-01 Thread Edward Wijaya
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 what you are trying to achieve. -- Regards, Edward WIJAYA SINGAPORE

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, another swartz transform

Re: Perl cant add up with sprintf ?

2004-11-25 Thread Edward WIJAYA
, 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 commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org

Re: How to finding sting in an array

2004-11-17 Thread Edward WIJAYA
-- 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 unsubscribe, e-mail

Re: How to finding sting in an array

2004-11-17 Thread Edward WIJAYA
) { 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
? 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: Accessing elements of an array passed by reference

2004-11-15 Thread Edward Wijaya
} 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, e-mail: [EMAIL PROTECTED] For additional

Re: how to pass array and variable

2004-11-09 Thread Edward WIJAYA
=opscakjbrtq79b6q%40mailhost.i2r.a-star.edu.sgrnum=20prev=/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: [EMAIL PROTECTED

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://learn.perl.org

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 want

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 hash question

Installing modules in Windows through -MCPAN and nmake problem

2004-11-07 Thread Edward WIJAYA
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 SINGAPORE -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional

Re: Getting perl to work on windows 98 se

2004-11-06 Thread Edward Wijaya
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: [EMAIL PROTECTED] For additional

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 and a varaible

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 %hash = (); while (DATA

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-mail: [EMAIL PROTECTED

Howto reverse SortByValue with Tie::IxHash

2004-10-02 Thread Edward Wijaya
, '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 this? Thanks beforehand. Regards, Edward WIJAYA SINGAPORE -- To unsubscribe, e-mail: [EMAIL PROTECTED

Re: Howto reverse SortByValue with Tie::IxHash

2004-10-02 Thread Edward Wijaya
() ); 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 WIJAYA SINGAPORE

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

2004-10-01 Thread Edward Wijaya
. 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, e-mail: [EMAIL

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

2004-10-01 Thread Edward Wijaya
, 'B', 2, 'C', 2 ] }; not; $VAR1 = { 'key1' = ['A',1],['B',2],['C',2]}; Regards, Edward WIJAYA SINGAPORE -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL

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 SINGAPORE __BEGIN__ use strict; use warnings; use Data

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 suggestion. Regards, Edward WIJAYA

Re: Problem with subroutines with hash and var as input

2004-10-01 Thread Edward Wijaya
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 Edward WIJAYA SINGAPORE

Re: Problem with subroutines with hash and var as input

2004-10-01 Thread Edward Wijaya
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

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

2004-09-30 Thread Edward Wijaya
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

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', B = 'dadada

How to access first key of Hash of Hash

2004-09-29 Thread Edward Wijaya
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 access first key of Hash of Hash

2004-09-29 Thread Edward Wijaya
question is how can I print output like: firstkey secondkey given the construction variables as mention before. Thanks 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 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 additional commands, e-mail

Re: Problem iterating over diamond (whileFILE)

2004-09-29 Thread Edward Wijaya
On 29 Sep 2004 14:06:33 -, Peter Scott [EMAIL PROTECTED] wrote: Nitpick - the diamond operator is . INFILE 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. Regards, Edward WIJAYA SINGAPORE

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 die $0 : failed to open

Problem iterating over diamond (whileFILE)

2004-09-28 Thread Edward Wijaya
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 $trial = 2; #What's wrong with running a for loop over

Re: Problem iterating over diamond (whileFILE)

2004-09-28 Thread Edward Wijaya
. __BEGIN__ for ( my $t = 1 ; $t = $trial ; $t++ ) { print Trial , $t, \n; while (INFILE) { print;} } close INFILE; open INFILE; #is this how you reopen? __END__ Hope you don't mind to elaborating it. Thanks again. Regards Edward WIJAYA -- To unsubscribe, e-mail

Re: Problem iterating over diamond (whileFILE)

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 (INFILE) {... } } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

How to return 'k'-cliques in a graph

2004-09-24 Thread Edward WIJAYA
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 SINGAPORE __BEGIN__ #! /usr/local/bin/perl use

Re: compare the content of a hash

2004-09-18 Thread Edward WIJAYA
://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

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] http://learn.perl.org/

Re: String to Numeric of an Array

2004-09-14 Thread Edward WIJAYA
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

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: 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

Splicing Hash problem

2004-09-06 Thread Edward WIJAYA
' = '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: Splicing Hash problem - possible with map?

2004-09-06 Thread Edward WIJAYA
, 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

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 additional commands, e

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

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

2004-09-02 Thread Edward Wijaya
as part of each elements in @arr1 such that it gives result: @arr3 =('GAtcctctaAAGGAGAGGTACTTACAGG', 'CGCCCAAGAGGCCAGaggccacCA', 'CGTTAAagctgcgAAGTTCT'); #the starting position to be copied to in @arr1 can is random. Thanks for your time. Regards, Edward WIJAYA

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: [EMAIL

Re: how can I |more output.

2004-08-26 Thread Edward Wijaya
I guess you should use the |more command in the command prompt not inside the perl code itself. perl code.pl option |more On Thu, 26 Aug 2004 09:36:38 +0200, Etienne Ledoux [EMAIL PROTECTED] wrote: ok. Here is the output I'm trying to '|more' while (@ref = $sth-fetchrow_array()) {

  1   2   >