Re: Creating hash with multiple keys for an array

2004-08-06 Thread Edward WIJAYA
Thanks so much for your reply Gunnar, The purpose is as follows. For example these lines: AGCAG,AGCCG,AGCCGGGCG,AGCCAGGAG 15.188721875540 AGCGGAGCG,AGCCGAGGG,AGCGGAGGG 16.163408331891 \_/ \_/ @Array1

iterate over the fields of a struct?

2004-08-06 Thread Christopher J. Bottaro
is there a way to iterate over the fields of a Class::Struct (in the order they were declared)? something like: foreach my $i (@{my_struct->fields()}) { print "$i = my_struct->value($i)\n"; } yeah i know its a long shot, but perl sometimes does things for me that i never would have beli

Re: using regexp to substitute - problem

2004-08-06 Thread Radhika Sambamurti
> > You probably want to use the word boundary assertion: > > s/\bTR\b/TC/g; > > See "perldoc perlre". > > -- > Gunnar Hjalmarsson > Email: http://www.gunnar.cc/cgi-bin/contact.pl Thanks! This worked. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTE

Re: using regexp to substitute - problem

2004-08-06 Thread Gunnar Hjalmarsson
Radhika Sambamurti wrote: I am trying to substitute "TR" for "TC". But I do not want words like "AUDIT TRAIL" to be substituted. So my regexp is: if( =~ / TR / ) { s/TR/TC/g } But this is not exactly working. You probably want to use the word boundary assertion: s/\bTR\b/TC/g; See "perldoc perl

using regexp to substitute - problem

2004-08-06 Thread Radhika Sambamurti
Hi, I am trying to substitute "TR" for "TC". But I do not want words like "AUDIT TRAIL" to be substituted. So my regexp is: if( =~ / TR / ) { s/TR/TC/g } But this is not exactly working. As i want only those instances when TR is surrounded by spaces ie not part of any other word to be substitute

RE: Using binding in order to pass values to a sql statement.

2004-08-06 Thread NYIMI Jose \(BMB\)
> -Original Message- > From: Wiggins d Anconia [mailto:[EMAIL PROTECTED] > Sent: Friday, August 06, 2004 6:09 PM > To: jason corbett; perl beginners > Subject: Re: Using binding in order to pass values to a sql statement. > > > > > > Hello all. I am trying to use bind_param to create

Re: Using binding in order to pass values to a sql statement.

2004-08-06 Thread Wiggins d Anconia
> > Hello all. I am trying to use bind_param to create a list of values in the form of an array. Then I want to query the data base using a basic sql statement where each value in my list (array) will be sent to the DBI in order to return a value. I am getting and error that says can't call method

RE: Using binding in order to pass values to a sql statement.

2004-08-06 Thread NYIMI Jose \(BMB\)
> -Original Message- > From: jason corbett [mailto:[EMAIL PROTECTED] > Sent: Friday, August 06, 2004 5:44 PM > To: perl beginners > Subject: Using binding in order to pass values to a sql statement. > > > Hello all. I am trying to use bind_param to create a list of > values in the for

Using binding in order to pass values to a sql statement.

2004-08-06 Thread jason corbett
Hello all. I am trying to use bind_param to create a list of values in the form of an array. Then I want to query the data base using a basic sql statement where each value in my list (array) will be sent to the DBI in order to return a value. I am getting and error that says can't call method "

Re: Creating hash with multiple keys for an array

2004-08-06 Thread Gunnar Hjalmarsson
Edward Wijaya wrote: Is there anyway in Perl to create hash with multiple key for an array? Yes. my %HoA = ( key1 => [ @array1 ] ); $HoA{key2} = $HoA{key1}; The purpose is as follows. For example these lines: AGCAG,AGCCG,AGCCGGGCG,AGCCAGGAG 15.188721875540 AGCGGAGCG,AGCCGAGGG,AGCGGA

Creating hash with multiple keys for an array

2004-08-06 Thread Edward WIJAYA
Hi, Is there anyway in Perl to create hash with multiple key for an array? The purpose is as follows. For example these lines: AGCAG,AGCCG,AGCCGGGCG,AGCCAGGAG 15.188721875540 AGCGGAGCG,AGCCGAGGG,AGCGGAGGG 16.163408331891 \_/ \_/

RE: floating point convertion

2004-08-06 Thread Charles K. Clarkson
Mark Cohen <[EMAIL PROTECTED]> wrote: : Hello Charles, : I don't understand why you are getting differnet : results. I checked approximatley 1000 records : containing different floating points and it seems : that the result is similar to the results I'm : getting from SAS but I'll try to understan

Re: RE : cryptic error messages in modules

2004-08-06 Thread Christopher J. Bottaro
Jose Nyimi wrote: > I made a copy-paste of your above code, added the following to call f(): > > package main; > My::Class::f(); > > And got the error message below: > Global symbol "$s" requires explicit package name at try.pl line 31. > Execution of try.pl aborted due to compilation errors. >

RE: Sorting an array of hashes

2004-08-06 Thread Chris Mortimore
-Original Message- From: Chris Mortimore [mailto:[EMAIL PROTECTED] Sent: Thursday, August 05, 2004 5:19 PM To: [EMAIL PROTECTED] Subject: Sorting an array of hashes I want to sort an AoH. Not each hash by its keys, but the array by the value of one of the keys in each hash. I know how t

RE: Using "do" versus "use" for subroutine

2004-08-06 Thread Bob Showalter
Edward Wijaya wrote: > 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

Re: Sorting HTML tables

2004-08-06 Thread Jeff 'japhy' Pinyan
On Aug 4, Perl said: >die "You must enter an argument. \n" if $#ARGV <0; I'd suggest using: die ... if @ARGV == 0; because it's easier to read and understand. >$logfile = chomp ($ARGV); Is that really your code? That doesn't make any sense to me. I think you meant: $logfile = $ARGV[0];

Re: doubt in Definition of sub routine.

2004-08-06 Thread Jeff 'japhy' Pinyan
On Aug 5, Jose Alves de Castro said: >sub trim($), for instance, means that trim will work on a scalar. It means that trim() expects ONE argument and will enforce scalar context on it. trim($foo) and trim(@bar) both work. >This is useful to, instead of something such as > >trim($var) > >use som

Re: How to avoid writing files that is used by other programs?

2004-08-06 Thread Gunnar Hjalmarsson
Nyimi Jose ) wrote: Gunnar Hjalmarsson wrote: Shu Hung wrote: I am writing a script to relocate some tar files in a folder. Since those tar files are scheduled to be written daily, I want to make sure I'm not moving any files which are being written by other programs... How can I do so? You can loc

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" Thanks so much for your time Regards, Edward WIJA

RE: How to avoid writing files that is used by other programs?

2004-08-06 Thread NYIMI Jose \(BMB\)
> -Original Message- > From: Gunnar Hjalmarsson [mailto:[EMAIL PROTECTED] > Sent: Friday, August 06, 2004 10:49 AM > To: [EMAIL PROTECTED] > Subject: Re: How to avoid writing files that is used by other > programs? > > > Shu Hung wrote: > > I am writing a script to relocate some tar f

Re: How to avoid writing files that is used by other programs?

2004-08-06 Thread Gunnar Hjalmarsson
Shu Hung wrote: I am writing a script to relocate some tar files in a folder. Since those tar files are scheduled to be written daily, I want to make sure I'm not moving any files which are being written by other programs... How can I do so? You can lock them. perldoc -f flock perldoc -q "l

How to avoid writing files that is used by other programs?

2004-08-06 Thread Shu Hung (Koala)
I am writing a script to relocate some tar files in a folder. Since those tar files are scheduled to be written daily, I want to make sure I'm not moving any files which are being written by other programs... How can I do so? Thanks a lot -- To unsubscribe, e-mail: [EMAIL PROTECTED] For ad