Finding time difference from two strings

2007-10-26 Thread Wijaya Edward
Hi, Suppose I have this two strings: my $beginning = 'Fri Oct 25 17:37:58 2007'; my $end = 'Fri Oct 26 06:54:09 2007'; How can I compute the time difference between them (in secs)? Is there any CPAN module that does that? I have a large text files which contain two columns (begin + end) which

Verified for Spam -RODIN- I2R: Howto Create An Acti onable Button with CGI.pm

2007-04-25 Thread Wijaya Edward
Hi all, I was resorting to this verbatim html print to do the task: print qq(\n); print qq(\n); print qq(\n); print qq(\n); print qq(\n); print qq(\n); I tried this with CGI.pm dialect, but doesn't seem to work: print start_multipart_form(), print start_form(-method=>"POST",

RE: Problem Accessing Perl ModulesThrough .htaccess

2007-04-09 Thread Wijaya Edward
Hi, > Add this line: > use lib '/home/sadm/lib/site_perl'; > At the top of your script,I think it should work well. As I mentioned earlier. I did. The exact path as you stated above. Still won't work. Although doing $ perl -c helom.cgi works on plain cmdline (with/without "use lib"). But no

RE: Problem Accessing Perl ModulesThrough .htaccess

2007-04-09 Thread Wijaya Edward
nv" direction in the httpd.conf. How do you do that? I can't see any directive related to that. Please advice. -- Edward WIJAYA SINGAPORE 2007/4/9, Wijaya Edward <[EMAIL PROTECTED]>: > > > Dear experts, > > I have the following simple Perl script (called "

Verified for Spam -RODIN- I2R: Problem Accessing Pe rl Modules Through .htaccess

2007-04-09 Thread Wijaya Edward
Dear experts, I have the following simple Perl script (called "hellom.cgi"): __BEGIN__ #!/usr/bin/perl use CGI qw/:standard :html3/; use CGI::Carp qw( fatalsToBrowser ); $CGI::POST_MAX=1024 * 100; # max 100K posts1 #-- # BEGIN { # if ( $EN

RE: how to make a perl script run in background..?

2006-10-15 Thread Wijaya Edward
Hi, You can do that with 'thread' or 'Acme::Spork'. As for thread you can do something like: __BEGIN__ use strict; use warnings; use threads; sub getArray { my ($arg1,$arg2) = @_; my @output = `./myscript1.pl $arg1 $arg2`; return chomp @output; } my( $arg1, $arg2 ) = @ARGV;

RE: Maximum value in Hash

2006-10-02 Thread Wijaya Edward
It depends what do you mean by maximum. Assume you have numerical value as hash values. You can do: use List::Util qw(max) my %hash = { foo => 3, bar=>2, qux=> 1}; my $max_val = max values %hash; Hope that helps. -- Regards, Edward WIJAYA From: Andrej Kast

RE: Position Weight Matrix of Set of Strings with Perl

2006-09-06 Thread Wijaya Edward
Dear Rob, I was trying your script with this set of strings: __DATA__ CAGGTG CAGGTG But how come it returns: $VAR1 = { 'A' => [ 0, '0.5' ], 'T' => [ 0, 0, 0, 0, '0.5' ], 'C' => [ '0.5' ], 'G' => [ 0, 0, '0.5', '0.5', 0, '0.5' ] }; Instead of the correct: $VAR1 = {

Position Weight Matrix of Set of Strings with Perl

2006-09-06 Thread Wijaya Edward
Dear Experts, I am looking for a really efficient way to compute a position weight matrix (PWM) from a set of strings. In each set the strings are of the same length. Basically PWM compute the frequency (or probabilities) of bases [ATCG] occur in each position/column of a string. For example

RE: Create HTML code with perl

2006-09-03 Thread Wijaya Edward
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Mon 9/4/2006 12:28 PM To: beginners@perl.org Subject: Create HTML code with perl Hi, I need print HTML codes with perl: Don't print the HTML verbatim like that. Check out CGI.pm. Makes your life easier.

RE: get week numeration in a year?

2006-09-01 Thread Wijaya Edward
Hi Look for a CPAN module called Date::Calc. There you can find a method called Week_of_Year. Hope that's what you want. Regards, -- Edward WIJAYA SINGAPORE From: Practical Perl [mailto:[EMAIL PROTECTED] Sent: Fri 9/1/2006 3:34 PM To: beginners perl Subje

RE: Problem with library paths

2006-08-21 Thread Wijaya Edward
Hi Toddy, Couple of questions comes to mind: 1. If this is really the same perl installation, I'd wonder first how you installed it. If you used the proper installers then I'd want to know what the difference between @INC is for root/non-root. 2. Are you using the same perl version when r

Re: Modifying a string

2006-06-02 Thread Wijaya Edward
> > I'm currently trying to find a good way to modify a string. A > > program returns me > > a MAC address under the form 0a0a0a0a0a0a, and I would like to > > tranform it to > > obtain : 0a:0a:0a:0a:0a:0a > > > > > Try this: > > $ perl -e '$str = "0a0a0a0a0a"; $str2 =join(":",$str=~ /(..

Re: Modifying a string

2006-06-02 Thread Wijaya Edward
> Hi, > Hi > I'm currently trying to find a good way to modify a string. A > program returns me > a MAC address under the form 0a0a0a0a0a0a, and I would like to > tranform it to > obtain : 0a:0a:0a:0a:0a:0a > Try this: $ perl -e '$str = "0a0a0a0a0a"; $str2 =join(":",$str=~ /(..)/g); print

Re: sorting?

2006-05-29 Thread Wijaya Edward
- Original Message - From: Beast <[EMAIL PROTECTED]> Date: Wednesday, May 31, 2006 1:59 pm Subject: sorting? > Hi, > > I have some rather big chunk of data, returned from ldap server. > The > format is simple: > "Displa name" <[EMAIL PROTECTED]> > > Simply displying data "as is" is

Howto check a parameter size in CGI.pm

2006-05-22 Thread Wijaya Edward
Hi, Is there a way to determine the size of a parameter of a textarea or filefield in CGI.pm? For example, given this form. __BEGIN__ use CGI qw/:standard/; # snip textarea( -name=> 'some_name', -rows=> 10, -columns

Converting a string to a filehandle

2006-05-21 Thread Wijaya Edward
Dear expert, Is there a way to do it? Module for it? Suppose I have this large string. my $string = 'foo bar qux woo etc etc'; I would like to convert that string as if it is stored inside a file, and bypassing the file creation step. For example, my $filehand

Re: Howto include string in system call - Answering (a) suggestion

2006-05-19 Thread Wijaya Edward
Dear Jupiter, > a) does it "do the job" by itself: > > #!/usr/bin/perl > > use strict; > use warnings; > > my $ue = 'whatever'; > my $con_type = 'whatever'; > my $nb_un= 'whatever'; > print "Running: perl compute_price.pl -email $ue -type $con_type - > unit > $nb_un\n"; > system "pe

Re: Howto include string in system call

2006-05-19 Thread Wijaya Edward
Dear Jupiter, > b) are the variables what you expect them to be in the spork()ed > process? Following your advice below it seem so. But... > > spork( > sub { > my ( $ue, $con_type, $nb_un ) = @_; > # write the variables to a file here and check that file afterward

Re: Howto include string in system call

2006-05-19 Thread Wijaya Edward
Dear Jupiter, Thanks so much for the reply. However... >you are not passing the variabels to > it > proeprly. > (an oi, why is that written so incredibly hard to read ???) > sorry about that. > So you see it has nothgin to do with using system it has to so > with > calling a funtion as i

Re: RE: Howto include string in system call

2006-05-19 Thread Wijaya Edward
Hi Nanda, Thanks for your reply. > > system("perl mycode.pl -email \"$receipt_email\" -type $sometype -unit > $some_unit"); > > But it still cannot work. What I have in mycode.pl looks like this: __BEGIN__ use strict; use Data::Dumper; use Getopt::Long; print Dumper [EMAIL PR

Howto include string in system call

2006-05-19 Thread Wijaya Edward
Hi all, How do you pass a string inside an under system call. I tried to pass a string like this under EMAIL option: system("perl mycode.pl -email 'test_string' -type $sometype -unit $some_unit"); or system("perl mycode.pl -email $receipt_email -type $sometype -unit $some_unit"); But wh

Looking for strategy advice for perl based cgi script

2006-05-18 Thread Wijaya Edward
Dear expert, I have the intention to write a Perl based CGI script that does the following steps: 1. Take user input - including email - with a CGI script (mail_result.cgi). 2. Based on these input param, submit a long running Perl script (compute_price.pl) on the background 3. Email

Mismatch Positions of Two Ambiguous Strings

2006-04-26 Thread Wijaya Edward
Hi, I have two strings that I want to compute the number of mismatches between them. These two strings are of the "same" size. Let's call them 'source' string and 'target' string. Now, the problem is that the 'source' and 'target' string may come in ambiguous form, meaning that in one position

Re: arguments

2006-04-20 Thread Wijaya Edward
Hi, > It's probably slower and higher memory usage, but it seems to make > sense. > Any one else have suggestions on how to keep the args straight? > I would document my functions first. Pod is good. The hash ref idea is good for constructors with lots of optional params. Regards, Edward WI

Re: Split function

2006-04-16 Thread Wijaya Edward
> Hi, > > To run/use Split function in the perl script , is it necessary to > include/add any perl module ? No no need. It is a built in function. perldoc -f split -- Regards, Edward WIJAYAA Institute For Infocomm Research - Disclaimer - This email is confidenti

Re: How to extract the path of the file name in perl

2006-03-28 Thread Wijaya Edward
Hi, > How to extract the path of the file name in perl use File::Basename especially the method: fileparse() Do: perldoc File::Basename Regards, Edward WIJAYA --- I²R Disclaimer -- This email is confidential and m

Re: Howto Install a Perl Wrapper Module for a C Library in HomeDirectory

2006-03-24 Thread Wijaya Edward
Hi Alan, Thanks a lot for the reply. But, the readme file of Tree::Suffix is not informative http://search.cpan.org/~gray/Tree-Suffix-0.13/ > its readme said to edit the file named config.in and in that file > tell it > where the (berkelyDB) C library is located. I already did that for libstree

Howto Install a Perl Wrapper Module for a C Library in Home Directory

2006-03-24 Thread Wijaya Edward
Hi, I am attempting to install a CPAN module: Tree::Suffix, in my local home directory. Since I don't have SU previlege. First of all I have installed the required libstree library (http://www.cl.cam.ac.uk/~cpk25/libstree/) in my particular home directory, namely $HOME/MyBioTool/libstree-0.4.2.

Re: new for reading file containing multiple records

2006-01-06 Thread Wijaya Edward
Hi, I would suggest you use the built-in BioPerl method for reading fasta (or other) format, for example: sub get_sequence_from_fasta { #designed for getting sequences into array from a file (fasta format), #input: file name use Bio::SeqIO; my $file = shift; my @seqs= ();

Problem obtaining rows with HTML::TableExtract

2005-12-07 Thread Wijaya Edward
Hi Hi, I am trying to parse a HTML file with HTML::TableExtract. The main aim is to capture the final rows (that contain "TOTAL") into array reference. How come my code below doesn't do the job? I have attached the html file (dm01g_4.html) which I want to parse/obtained final result __BEGIN_

Re: how to get file's creation time

2005-11-27 Thread Wijaya Edward
- Original Message - From: Jennifer Garner <[EMAIL PROTECTED]> Date: Monday, November 28, 2005 12:30 pm Subject: how to get file's creation time > How to get file's creation time,NOT last modify time?Thanks. I don't think it is possible, in unix environment. Read this comment by Ran

Shortest One-liner to Rename Files

2005-11-10 Thread Wijaya Edward
Hi all, I have a snippet that rename files from: "sth.txt.out" into "sth.out" Now I am really curious how can I make this oneliner "even shorter": $ perl -e ' for(glob ("*.txt.out")){ $out = $_; $out =~ s/\.txt(\.out)/\.out/; rename ($_,$out); }' Hope to hear from you again. -- Regards, Ed

Re: Connecting to a database using perl

2005-11-08 Thread Wijaya Edward
Check this out: http://www.perlmonks.org/?node=Tutorials#datafiles -- Regards, Edward WIJAYA - Original Message - From: Manish Uskaikar <[EMAIL PROTECTED]> Date: Wednesday, November 9, 2005 1:53 pm Subject: Connecting to a database using perl > Hi, > > I am a real newbie to databases an

How to put brackets in a string given substrings

2005-10-28 Thread Wijaya Edward
Dear Sirs, I have the following problem. I am trying to put the bracket in a string given the set of its substrings. Those bracketed region is "bounded" by the given substrings. Like this, given input "String" and it's "substrings" String 1.CCCATCTGTCCTTATTTGCTG 2.ACCCATCTGTCCTTGGCCAT 3.CCAC

Re: how to get defined number of digits after point of a variable

2005-10-20 Thread Wijaya Edward
> Hi: Hi > For example, for $j=2.56789, how can I get the very first two digits > after points,ie, I just want to get 2.56. > Thank you very much in advance. > Is this what you want? $ perl -e '$j = 2.56789; $j =~ /(\d\.\d\d)+/; $ns = $1; print "$ns\n";' prints: 2.56 Read: perldoc perlretut.

Re: for each

2005-10-07 Thread Wijaya Edward
Hi Mark, > > > > Edward, for a beginner, would you mind explaining what the >(1 .. $#arr) $#arr is the index of the last element in the array > and qw actually do in this code.? Cheers with "qw" you are treating values inside as individual words automatically. Thus you don't need to put quo

Re: for each

2005-10-07 Thread Wijaya Edward
- Original Message - From: [EMAIL PROTECTED] Date: Friday, October 7, 2005 3:29 pm Subject: for each > Hi there! > Hi! > How do I get a for each-statement to start at element 1 (second > element) $ perl -e ' @arr = qw (a b c); foreach(1 .. $#arr) { print "$arr[$_]\n"; }' prints:

How to Update Hash to Itself Recursively

2005-09-16 Thread Wijaya Edward
Dear Guru, The simple example below is by the process of "appending" the elem of @tojoin and %line. My code below attempt to update the hash recursively. Keep processing it until string "AYW". The appending process is for simple illustration. Actually there is other more process to it. But my

Re: Help with sprintf

2005-09-12 Thread Wijaya Edward
- Original Message - From: Kevin Old <[EMAIL PROTECTED]> Date: Tuesday, September 13, 2005 5:31 am Subject: Help with sprintf > Hello everyone, Hello, > My result is: 20050901, but what I'm trying to get is 050901. > You can try with two possibilities: 1. Using Mod 100 on the year.

Re: Passing nested hash to a function

2005-08-13 Thread Wijaya Edward
> Hi Hi > output. What am I missing? Perhaps this is what you want? sub func { my $h = shift; for $k (keys %$h) { print "$k\n"; for $n ( keys %{ $h->{$k} } ) { print "$n => $h->{$k}{$n}\n"; } Read: perldoc perldsc Hope that helps. Regards, Edward WIJAYA SING

Re: Remembering Positions in Array after processing the element

2005-07-31 Thread Wijaya Edward
Dear John, Thanks so much for your snippet. It's been really really helpful. > I guess you didn't see Chris' posting. :-) I'm really sorry. Will try to be more attentive next time. --- Regards, Edward WIJAYA -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAI

Re: Remembering Positions in Array after processing the element

2005-07-31 Thread Wijaya Edward
Hi John, I was testing your code below with this array: my @x = qw( * * A B C D ); but how come in the end it gives: * XA * XB XC XD X instead of * * XA XB XC XD -- Regards, Edward WIJAYA SINGAPORE - Original Message - From: "John W. Krahn" <[EMAIL PROTECTED]> Date: Monday, Augus

Re: Can anyone guide me for : Data Structures in Perl

2005-07-17 Thread Wijaya Edward
You can find everything you need in: perldoc perldsc -- Regards, Edward WIJAYA SINGAPORE > > can anybody help me with a link or a tutorial for > understanding the Datastructures in perl. > > Example, Array of Array, Hash of Array, Hash of Hash, > Array of Hash. -- To unsubscribe, e-mail:

Re: how to append blocks in same file

2005-06-22 Thread Wijaya Edward
> and i want to append(or i should say merge) these blocks and get a > file like this: > aaabbbccc > aaabbbccc I've asked the same question some time ago, check this out: http://groups-beta.google.com/group/perl.beginners/browse_thread/thread/4f28012f744d10e0/7638b6eb94a626d2?q=edward+wijaya+g

Re: where to get perldoc Net::Telnet? missing in the perldoc from perldoc.perl.org

2005-06-20 Thread Wijaya Edward
Which version are you using? Check the standard CPAN site, you will find: http://search.cpan.org/~jrogers/Net-Telnet-3.03/lib/Net/Telnet.pm HtH -- Regards, Edward WIJAYA SINGAPORE - Original Message - From: MEENA SELVAM <[EMAIL PROTECTED]> Date: Tuesday, June 21, 2005 12:29 pm Subject: w

Re: Hash of Lists

2005-06-06 Thread Wijaya Edward
> Specifically > # append new members to an existing family > push @{ $HoL{"flintstones"} }, "wilma", "betty"; > > I don't understand why the construct @{ x } is written that way. Step by step, what it does is: 1. Dereference the List in the Hash with key "flinstones" ---> @{$array_ref}

Re: Can erpl support recursice call?

2005-05-22 Thread Wijaya Edward
That's very clever John, I'm wondering why ($cnt++) won't work instead of this > recursive(++$cnt) if $cnt<10; I tested it, it gave endless recursion. And what's the meaning of "0" here? Why didn't you pass "1" as for recursive(1), which is more sensible to me? Which also works. > recursive(0);

Re: Can perl support recursive call?

2005-05-22 Thread Wijaya Edward
Hi, Of course! This is the example of a script with recursive call that produces a list of the directory paths and filenames of all ".htm" and ".shtm" files contained within the subdirectory assigned to the $base variable. __BEGIN__ #!/usr/local/bin/perl $base = "/home/users/myspace/html/"; $d

Re: Howto Dynamically Combine Multiple Array in HoA

2005-05-04 Thread Wijaya Edward
- Original Message - From: Xavier Noria <[EMAIL PROTECTED]> Date: Wednesday, May 4, 2005 3:03 pm Subject: Re: Howto Dynamically Combine Multiple Array in HoA > my %hoa = @_; > while (my $keys = $iter->next) > { ># given a representative in $keys generate the one we ne

Re: Howto Dynamically Combine Multiple Array in HoA

2005-05-03 Thread Wijaya Edward
Thanks so much, Xavi. - Original Message - From: Xavier Noria <[EMAIL PROTECTED]> Date: Wednesday, May 4, 2005 4:42 am Subject: Re: Howto Dynamically Combine Multiple Array in HoA > Is that what you wanted? Yes it works just as I wanted. This is my final subroutine using your suggestio

Re: Require / Use

2005-04-21 Thread Wijaya Edward
This is the reading suggested when I asked the same questions some time ago . http://perldoc.perl.org/perlfaq8.html#What-s-the-difference-between-require-and-use- --- Regards, Edward WIJAYA SINGAPORE -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTE