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
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",
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
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 "
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
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;
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
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 = {
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
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.
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
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
> > 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=~ /(..
> 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
- 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
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
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
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
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
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
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
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
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
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
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
> 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
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
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
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.
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= ();
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_
- 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
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
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
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
> 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.
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
- 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:
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
- 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.
> 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
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
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
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:
> 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
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
> 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}
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);
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
- 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
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
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
52 matches
Mail list logo