Re: pipe as an argument

2006-09-06 Thread jeffhua
Don't write it like this.Consider this case: $ARGV[0] ==0; then your statement : my $time_in = $ARGV[0] || STDIN; should be broken. --Jeff Pang -Original Message- From: [EMAIL PROTECTED] To: beginners@perl.org Sent: Wed, 6 Sep 2006 1:58 PM Subject: Re: pipe as an argument On

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: pipe as an argument

2006-09-06 Thread Dr.Ruud
Budi Milis schreef: How do accept pipe as an valid argument in perl, for example: echo 123456 | ./convert_time.pl convert_time.pl: #!/usr/bin/perl use POSIX qw(strftime); my $time_in = $ARGV[0]; my $time_out = strftime %Y%m%d, localtime($time_in); print $time_out\n; I don't really

Re: Position Weight Matrix of Set of Strings with Perl

2006-09-06 Thread Mumia W.
On 09/06/2006 04:02 AM, Wijaya Edward wrote: 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

Re: Position Weight Matrix of Set of Strings with Perl

2006-09-06 Thread Rob Dixon
Wijaya Edward wrote: 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

Re: Need Help

2006-09-06 Thread Ashok Varma
Hi Kishore, The below snippet will get your desired result. --- #!/usr/bin/perl use strict ; my @structure_name = (); my $fni = 'd:\Sample.txt' ; my $fno = 'd:\ashok.txt'

Re: Position Weight Matrix of Set of Strings with Perl

2006-09-06 Thread Dr.Ruud
Rob Dixon schreef: use strict; use warnings; my %pwm; while (DATA) { my $col = 0; foreach my $c (/\S/g) { $pwm{$c}[$col++]++; } } foreach my $freq (values %pwm) { $_ = $_ ? $_ / keys %pwm : 0 foreach @$freq; } use Data::Dumper; print Dumper \%pwm; __END__

Perl interface with Oracle

2006-09-06 Thread Puri, Nilay
Hi All, On Unix box we have Oracle 9i and Perl 5.8 Now we are upgrading Oracle to 10g. In that case we need to re-intsall Perl DBD module. Is there any other activity that should be taken care of ? Thanks in advance, Nilay

Re: pipe as an argument

2006-09-06 Thread Randal L. Schwartz
Budi == Budi Milis [EMAIL PROTECTED] writes: Budi On 9/6/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Consider this: my $arg = @ARGV ? shift @ARGV : STDIN; Budi Works as I expected, many thanks. Budi However, my previous code was: Budi my $time_in = $ARG[0] || STDIN; Budi and it doesn't

arithmetic expression while substituting

2006-09-06 Thread Michael Alipio
Hi, Suppose I have the output of this command date +%d.%H which outputs: 06.11 I want to adjust the last two digits to less 1: such that it becomes 06.10.. how do I do that? perhaps something like this. s/\d+$/(regexp being lookup minus 1/ thanks!

Re: arithmetic expression while substituting

2006-09-06 Thread Adriano Ferreira
On 9/6/06, Michael Alipio [EMAIL PROTECTED] wrote: I want to adjust the last two digits to less 1: perhaps something like this. s/\d+$/(regexp being lookup minus 1/ s/(\d+)$/$1-1/e is going to work, even though it is convoluted and not robust. For example, '06.00' will become '06.-1' --

Re: arithmetic expression while substituting

2006-09-06 Thread Jay Savage
On 9/5/06, Michael Alipio [EMAIL PROTECTED] wrote: Hi, Suppose I have the output of this command date +%d.%H which outputs: 06.11 I want to adjust the last two digits to less 1: such that it becomes 06.10.. how do I do that? perhaps something like this. s/\d+$/(regexp being lookup minus 1/

Net:SSH:Perl error

2006-09-06 Thread Jim
Hi, I have a script that I have been running successfully on perl 5.6.1. It uses Net::SSH to send the code of another perl script to a remote host. I tried to move the script(s) to a new box running 5.8 and it errors out while trying to run the cmd method on the command string passed to it. Here

Re: Net:SSH:Perl error

2006-09-06 Thread Tom Phoenix
On 9/6/06, Jim [EMAIL PROTECTED] wrote: input must be 8 bytes long at /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/Crypt/DES.pm line 57. I suspect that this is related to Unicode: A string of eight characters isn't necessarily eight bytes anymore. If you can track down the source

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

regular expression question

2006-09-06 Thread chen li
Hello all, I need a regular expression to process some data but get stuck. I wonder if anyone here might have a clue. input: my $line='group A 1 2 3 4';# separated by space results: my @data=(group A ,1,2,3,4); Thanks, Li __ Do You Yahoo!?

Re: regular expression question

2006-09-06 Thread Adriano Ferreira
On 9/6/06, chen li [EMAIL PROTECTED] wrote: I need a regular expression to process some data but get stuck. I wonder if anyone here might have a clue. input: my $line='group A 1 2 3 4';# separated by space results: my @data=(group A ,1,2,3,4); You barely need a regular expression for

How to write an integer to socket

2006-09-06 Thread zhao_bingfeng
Hi, guys In a udp socket test routine, I want to write some integers to server in network order. But unfortunately, my server receive just chars! how can I do? My code: #! /usr/bin/perl use IO::Socket; $sock = new IO::Socket::INET (PeerAddr = '192.168.89.166',

Re: How to write an integer to socket

2006-09-06 Thread Adriano Ferreira
On 9/6/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, guys In a udp socket test routine, I want to write some integers to server in network order. But unfortunately, my server receive just chars! how can I do? Take a look at 'perldoc pack' -- To unsubscribe, e-mail: [EMAIL PROTECTED] For

Re: How to write an integer to socket

2006-09-06 Thread Adriano Ferreira
On 9/7/06, Adriano Ferreira [EMAIL PROTECTED] wrote: On 9/6/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, guys In a udp socket test routine, I want to write some integers to server in network order. But unfortunately, my server receive just chars! how can I do? Take a look at 'perldoc

Re: How to write an integer to socket

2006-09-06 Thread Tom Phoenix
On 9/6/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: In a udp socket test routine, I want to write some integers to server in network order. my $v = 3; foreach (1 .. 3) { print $sock $v++; } That doesn't look like network order, it looks like plain text. Didn't you want to use pack()?

Re: regular expression question

2006-09-06 Thread chen li
--- Adriano Ferreira [EMAIL PROTECTED] wrote: On 9/6/06, chen li [EMAIL PROTECTED] wrote: I need a regular expression to process some data but get stuck. I wonder if anyone here might have a clue. input: my $line='group A 1 2 3 4';# separated by space results: my

答复: How to write an integer to socket

2006-09-06 Thread zhao_bingfeng
yeah, I know, thanks for clue, I just cannor remember the functions. :) -邮件原件- 发件人: Adriano Ferreira [mailto:[EMAIL PROTECTED] 发送时间: 2006年9月7日 11:01 收件人: [EMAIL PROTECTED]; beginners@perl.org 主题: Re: How to write an integer to socket On 9/7/06, Adriano Ferreira [EMAIL

Re: regular expression question

2006-09-06 Thread Mumia W.
On 09/06/2006 09:49 PM, chen li wrote: Hello all, I need a regular expression to process some data but get stuck. I wonder if anyone here might have a clue. input: my $line='group A 1 2 3 4';# separated by space results: my @data=(group A ,1,2,3,4); As Adriano Ferreira said, you

Re: Position Weight Matrix of Set of Strings with Perl

2006-09-06 Thread Mumia W.
On 09/06/2006 05:41 AM, Mumia W. wrote: On 09/06/2006 04:02 AM, Wijaya Edward wrote: Dear Experts, I am looking for a really efficient way to compute a position weight matrix (PWM) [...] Although I'm sure that smarter posters than I will [...] do it right. Ugh, I forgot about Wijaya's