formatting text

2001-09-19 Thread Edward
Hi , I'm trying to extract clients with Lost-Carrier as Terminate-Cause from a raw radius file. I'm interested in 2 fields. User-name and Terminate Cause. On running my script. I get a full list of all client User-names. and those with Termiante-Cause. Can some one assist me "One cannot guess t

Strange behaviour in accessing array element

2004-06-02 Thread Edward Wijaya
our time. Hope to hear from you again. Regards, Edward WIJAYA SINGAPORE Code: #!/usr/bin/perl -w use strict; my @array = qw(ATGC ); my @pwmA = ( 2, 0, 0, 1 ); my @pwmT = ( 4, 1, 1, 0 ); my @pwmC = ( 0, 0, 0, 1 ); my @pwmG = ( 1, 1, 2, 1 ); my @pvalueA=(); my @pvalueT=(); my @pvalue

NET::FTP

2004-06-05 Thread Edward Ludlow
Hi all, I'm a newbie to Perl - I'm having to dip in and try and do some coding as I need a script that will move a file from one server to another. I believe this can be done with the Net::FTP object. I've played around whit this a fair bit, and I think this script should work.. #!/usr/bin/pe

Re: NET::FTP

2004-06-05 Thread Edward Ludlow
philipp traeder wrote: "perldoc Net::FTP" is your friend - there you'll find documentation for the put() method, which should be what you want. Basically, you just need to extend your script a bit - something like: my $ftp = Net::FTP->new(...); $ftp->login("username", "password"); # change the w

Concatenating line into array problem

2004-06-10 Thread Edward Wijaya
ay to do this. But I can't seem to figure out how to achieve that. Your advice is very much appreciated. Thanks so much for your time. -- Regards, Edward WIJAYA SINGAPORE #---My Code -- while (<>) { if (/^>/) { next; } chomp; $line .= $_; } push (@crs

Re: Concatenating line into array problem

2004-06-10 Thread Edward Wijaya
ed out second '>' part of the fasta file. Any clue? Thanks again before hand. 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>

Re: Concatenating line into array problem

2004-06-10 Thread Edward Wijaya
27;t give precise example. Regards, Edward WIJAYA YAP_up800.fasta Description: Binary data -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: loop jumping

2004-06-15 Thread Edward Wijaya
perldoc -f last 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>

Re: printing array elements in columns

2004-06-18 Thread Edward Wijaya
dd 22 cd ee 33 de ff 44 - gg 55 - hh- Regards, Edward WIJAYA SINGAPORE -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PRO

Hash of an array with colon and comma separator

2004-07-06 Thread Edward Wijaya
s the hash name and the 'words that comes with commas' after the colon is the element. Is there any efficient way to do this? Thanks so much for your time. Hope to hear from you again. Regards Edward WIJAYA SINGAPORE -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional comm

Processing files in Multiple directories (Bash or Perl?)

2004-07-19 Thread Edward WIJAYA
uld any body kindly advice? Thanks so much for your time. Hope to hear from you again Regards Edward WIJAYA SINGAPORE -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

How to pass two arrays as arg in a subroutine?

2004-08-05 Thread Edward Wijaya
gards, 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>

Testing whether an array has any elements in it

2004-08-05 Thread Edward Wijaya
Hi, Is there any efficient way to do that? 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 pass two arrays as arg in a subroutine?

2004-08-05 Thread Edward Wijaya
Thanks so much Kamal, your explanation is very clear and complete. It works now. I learnt a great deal from it. Regards Edward WIJAYA Hope this is useful for you. For more on references go through "perldoc perlref" With Best regards, R. Kamal Raj Guptha. -- To unsubscribe, e-ma

Using "do" versus "use" for subroutine

2004-08-06 Thread Edward Wijaya
Hi, I would like to know which of this is better and what is the pro and cons: 1. A file "mysub.pl" which stored a subroutine, and later called by main file using: do "mysub.pl" or 2. A file "mysub.pm" and called in main file using : use "mysub.pm" Than

Creating hash with multiple keys for an array

2004-08-06 Thread Edward WIJAYA
\_/ \_/ @Array1 $Key1 I want to store @Array1 under hash with $Key1 AND scalar(@Array1) as $Key2. Because later I need to sort the hash based on $Key1 and $Key2. Thanks so much for your time. Regards, Edward WIJAYA SINGAPORE -- To unsubscribe, e-mail: [EMAIL PROTECTED] For

Re: Creating hash with multiple keys for an array

2004-08-06 Thread Edward WIJAYA
keys for sorting purpose? 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: Creating hash with multiple keys for an array

2004-08-07 Thread Edward WIJAYA
CC 16.1887218755409 Sorted by number of elements D: GAAGCTGAG GGAGCTGGG GGAGCTGAA 15.2451124978365 E: GGCAG GCCAC GTCCCCCAG 15.2451124978365 F: GGAAGCTGA GGGAGCTGG GGGAGCTGA 16.163408331891 A: AGCAG AGCCG AGCCGGGCG AGCCAGGAG 15.1887218755409 C: GCAGCTGGG GCAGCTGGA GGAGCTGGG GGAGCTGAA 15.

Re: Creating hash with multiple keys for an array

2004-08-07 Thread Edward WIJAYA
i(0..$#AoH) { for my $on_ic (keys %{$AoH[$i]}) { #LINE 2 print "@{ $AoH[$i]->{values} }", " ","$AoH[$i]->{ic}\n"; } } END I also tried to ammend LINE 2 to sort according to IC with this: for my $on_ic (sort {$AoH[$i]-&

Re: Creating hash with multiple keys for an array

2004-08-08 Thread Edward WIJAYA
far. Actually I did some reading on array sorting. However, I admit I didn't do enough reading especially on the topic of "hash reference". Gratefuly yours, Edward WIJAYA SINGAPORE -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Assigning fix elements of array into fix variables efficiently

2004-08-23 Thread Edward Wijaya
. Thanks before hand. Hope to hear from you again. 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: Assigning fix elements of array into fix variables efficiently

2004-08-23 Thread Edward Wijaya
Thanks so much. On Mon, 23 Aug 2004 03:17:40 -0400, Jeremy Kister <[EMAIL PROTECTED]> wrote: On Monday, August 23, 2004 3:12 AM, Edward Wijaya wrote: @array = (10,11,12) #fix to three element is there any way I can assign each any of these elements into variable ($A, $B, $C) in a quick way

Appending array from HoA elements into one single array

2004-08-24 Thread Edward WIJAYA
Hi, Suppose I have this Hash of array: %HoA = { A => ["fred", "barney"], B => ["george", "jane", "elroy"], }; Is there any efficient way to append each of this HoA's array into one single array, e.g: @name = ("fred",

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 |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()) {

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

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

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

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

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

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>

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 P

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>

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>

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

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

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 $

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

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]

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',

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>

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

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

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

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' => ['

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

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

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

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

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

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

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

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

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

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: removing line from a file

2004-12-02 Thread Edward WIJAYA
Hi, Edward: Your script doesn't work, as you are only opening the file in read mode. Read/write doesn't do want you want either. {Blushes} Thanks for the correction Jon. If you want a quick'n'easy one liner, then use -i: -i[extension] edit <> files in place

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

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

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

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

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>

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>

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

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

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

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

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

  1   2   3   4   5   6   7   8   9   10   >