how to avoid process die when can't create mysql dbh

2005-10-25 Thread Jeff Pan
hi, Because of network problem,my script can't create Mysql dbh sometime when running,then it died.I have written code like this: my $mysql_dbh=DBI->connect("dbi:mysql:$mysql_db:$mysql_host",$mysql_user,$mysql_passwd, {PrintError => 1,RaiseError => 0}); I want to

Re: Space proplem

2005-10-14 Thread pan
Hi Martha, Although I do not understand exactly what it is that you want, the following could help ... #1# $msg =~ s/\"/'/igx; #2# if (($msg=~ /gu1/i) && ($msg !~ /gu1[0123456789]+/i)) First remove line #1#. I guess you did an attempt to remove quotes here, that weren't even there (you can see i

difference between '&subroutine()' and 'subroutine()'

2005-10-12 Thread Jeff Pan
HI, I want to know what's the difference when I call a subroutine with '&' or without '&'. such as: &subroutine(); sub subroutine{ .. } or subroutine(); sub subroutine{ .. } Can anyone tell me?thanks a lot. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail:

Re: compare two files

2005-10-11 Thread Jeff Pan
Your code logic says that you want to find lines in '2.txt' that are NOT in '1.txt'. thanks for all answerers. yeah,I have put less attention on that code,and have made a fatal logic error. but the way mentioned by John, putting file's all contents to a hash, maybe somewhat less efficiency when

compare two files

2005-10-11 Thread Jeff Pan
hi, Is there a best way to find some lines which exists in both two files? Someone has show me a method but it seems a little low efficiency. The code is as below: open (T1,"1.txt") or die "$!"; open (T2,"2.txt") or die "$!"; while(my $line=){ chomp $line; print $line,"\n" unless diff($line)

Re: Redirecting STDERR

2005-10-07 Thread Jeff Pan
hi, maybe u should redefined the __DIE__ handle for the reason of safety. such as: $SIG{__DIE__}=\&log_die; sub log_die { open (HDW,">>",$err_log); select HDW;$|=1;select STDOUT; print HDW @_; close HDW; die @_; } 2005/10/8, Timothy Johnson <[EMAIL PROTECTED]>: > It partly de

move applications from traditional CGI to mod_perl

2005-09-23 Thread Jeff Pan
hi,everyone, I want to move my web applications which written by traditional CGI to mod_perl.Is there any risk or difficulty here? The applications are something about webmail.Which module under mod_perl is suited for me? Any advise or reference to me should be appreciated.TKS. -- Jeff Pan

about sleep: is it a bug?

2005-09-20 Thread Jeff Pan
$total{$mbox_id}{$type}+=$size; } close HD; `cat /dev/null > $log`; &disable(\%total); } } ------ -- Jeff Pan [EMAIL PROTECTED] -- http://www.fastmail.fm - Choose from over 50 domains or

Re: keys of hash of hashes

2005-09-16 Thread Jeff Pan
ari Tent' => 'LuxTnt' >}, > > I basically want just: > > Luxury, Thatched Chalet', Luxury Safari Tent etc. > > If anyone would could assist me, I would be most grateful. > > Kind Regards > Brent Clark > > --

about utf8

2005-09-14 Thread Jeff Pan
me some advises? thanks. -- Jeff Pan [EMAIL PROTECTED] -- http://www.fastmail.fm - A no graphics, no pop-ups email service -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

RE: Regex - find chars between ()

2005-09-12 Thread Jeff Pan
/$host/; $_=~/\((\w+)\,\s*(\d+)\)\s+\((\w+)\,\s*(\d+)\)/; #my @array=("$1","$2","$3","$4"); my @array=qw/$1 $2 $3 $4/; print join (":",@array),"\n"; } executing the script: $ perl t10.pl tt2.txt $1:$2:$3:$4 why this happen?

Re: Regex - find chars between ()

2005-09-12 Thread Jeff Pan
Sorry,it should be: $_=~/\((\w+)\,\s*(\d+)\)\s+\((\w+)\,\s*(\d+)\)/; Didn't consider the blank space before. On Mon, 12 Sep 2005 14:54:56 +0800, "Jeff Pan" <[EMAIL PROTECTED]> said: > Is this feasible? > > while(<>) > { > next unless /$host/;

Re: Regex - find chars between ()

2005-09-11 Thread Jeff Pan
Root = "/gjkeenan/G7"; > my $fileG7 = "$dirRoot/G7"; > my $filePW = "$dirRoot/PW"; > > open(PWFILE, "$filePW") > || die "Can't open $filePW: $!"; > while () { > if (/$host/) { > my @c = /(\D,\d\d)\s(\D,\d\d)/; > }

Re: catching output from ping

2005-09-09 Thread Jeff Pan
er, > ping returns a success regardless of whether or not > packets are received. > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > <http://learn.perl.org/> <http://learn.perl.org/first-response> > > -

Re: 2-way lookup

2005-09-08 Thread Jeff Pan
Sure,this code is more brief: $hash{$i++}=[split] while (<>); thank u. On Thu, 08 Sep 2005 19:54:11 -0700, "John W. Krahn" <[EMAIL PROTECTED]> said: > Jeff Pan wrote: > > #/usr/bin/perl > > use warnings; > use strict; > > > my $i=0; >

Re: 2-way lookup

2005-09-08 Thread Jeff Pan
ta1 = $line[1]; > @line = $lines[2]; > $coordData2 = $line[3]; > ...do something with $coordData1 & $coordData2 > > I'm hoping for a better way and I'm looking for suggestions. > > Thanks for your time. > > Greg Keenan > Lucent Technologies * >

Re: extract web pages from a web site

2005-09-08 Thread Jeff Pan
> > Which perl module can I use to help me to do this task > > > > Thanks > > > > > > José Pinto > -- Jeff Pan [EMAIL PROTECTED] -- http://www.fastmail.fm - mmm... Fastmail... -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional comm

Re: Looping over an array of hashes problem

2005-09-08 Thread Jeff Pan
gt; > Cheers, > > Graeme :) > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > <http://learn.perl.org/> <http://learn.perl.org/first-response> > > -- Jeff Pan [EMAIL PROTECTED]

Re: deciphering regular expressions

2005-09-07 Thread Jeff Pan
gt; For additional commands, e-mail: [EMAIL PROTECTED] > <http://learn.perl.org/> <http://learn.perl.org/first-response> > > -- Jeff Pan [EMAIL PROTECTED] -- http://www.fastmail.fm - Or how I learned to stop worrying and love email again --

Re: naming subroutine reference parameter?

2005-09-06 Thread Jeff Pan
my @[EMAIL PROTECTED]; > > This isn't needed actually and it only makes unnecessary overhead as > keys/values are copied, so you immediately lost benefit by passing by > reference. > > It's better to access them directly like, > $hash_ref->{key} > $array

Re: naming subroutine reference parameter?

2005-09-06 Thread Jeff Pan
more safer. for example,such below code is right: my (%hash,@array); &sub_test(\%hash,[EMAIL PROTECTED]); sub sub_test{ my ($hash_ref,$array_ref)[EMAIL PROTECTED]; my %hash=%$hash_ref; my @[EMAIL PROTECTED]; do something... } -- Jeff Pan [EMAIL PROTECTED] -- http://www.fastmail.fm - IMA

Re: mysql server has gone away

2005-09-04 Thread Jeff Pan
> this > code before. something's happened to a configuration, or something, and i > can't figure out why. i'm now tearing my hair out over this. > has anyone ever come across this before? if so, how did you fix it? > > many thanks > dan > > > > -- &g

Re: Could u plz tell me how to remove white spacees present between delimiter

2005-09-02 Thread Jeff Pan
; e-mail message and/or attachments to it are strictly prohibited. If you > have received this communication in error, please notify us by reply > e-mail or telephone and immediately and permanently delete the message > and any attachments. Thank you -- Jeff Pan [EMAIL PROTECTED] -

Re: parsing long strings

2005-09-02 Thread Jeff Pan
e /g would stop that > behaviour.. > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > <http://learn.perl.org/> <http://learn.perl.org/first-response> > > -- Jeff Pan [EMAIL PROTECTED] -- http://www.fas

Socket Problem

2005-08-31 Thread Jeff Pan
et->accept; die "can't fork:$!" unless defined (my $child = fork()); if ($child==0) { $listen_socket->close; &writelog($connection); exit 0; } $connection->close; } thanks. -- Jeff Pan [EMAIL PROTECTED] -- http://www.fa

Re: how to replace multiple whit space with ", ".

2005-08-30 Thread Jeff Pan
"this, is a, space" > > Hope someone can help, > > Bernard > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > <http://learn.perl.org/> <http://learn.perl.org/first-response> &g

Interactive with other program

2005-06-29 Thread Gao Yong Pan
hi, I want to write a perl script that interactive with other program or script. when I run the jacl script which askes me to input some parameters interactively, just like this, when I issue wsadmin -f trade.jacl, then I have to answer some questions like below, Global security is (or will be)

hash of ref to array of arrays, lost all but the last element in hash

2001-08-23 Thread Jennifer Pan
Dear all, I would like to construct a hash, whose value holds a reference to an array of arrays, however all the keys in my hash have the exact same value, which turns out to be the value of the last element I put it!! I felt that something is wrong in the data structure, that I should not keep

two .pl use each other?

2001-08-21 Thread Jennifer Pan
I have two perl programs x1.pl and x2.pl In x1.pl, I really want to call x2.pl as a function to finish the task, is there a way to pack them so they can use one another? thank you! -Jennifer -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

FW: hash, key value

2001-08-21 Thread Jennifer Pan
> -Original Message- > From: Jennifer Pan > Sent: Tuesday, August 21, 2001 6:08 PM > To: '[EMAIL PROTECTED]' > Subject: hash, key value > > Dear all: > I would like to construct a hash, the value of each key is a bunch of > ref

chomp & list

2001-08-20 Thread Jennifer Pan
I have a file : #myfile.txt a b c d a c s g g o y g _END_ I wrote a perl script to put each line into a list; #/usr/bin/perl -w open (FH, "myfile.txt") ; while ($LINE = ) { chomp $LINE; push @list, $LINE; } close FH; print $_

print the array values in a hash

2001-08-16 Thread Jennifer Pan
I have a hash and the 'value' associated with each key is an array of strings. (I do not care the strings are in order, so I suppose an embedded hash would do too); I want to print out the keys and each element of the array that associated with each key I did: foreach $key (keys %hash) { pri

RE: URL access

2001-08-15 Thread Jennifer Pan
Apologize for the naivety, but there are so many modules related with LWP at cpan ( I searched for LWP), which one do I download? And how do I know if we already have LWP module at our local machine? thank you very much!! -Jennifer Pan -Original Message- From: Jos I. Boumans [mailto

RE: grep repetitive elements?

2001-08-10 Thread Jennifer Pan
thanks all! This works, and I am reading Perl cookbook. -Original Message- From: Jeff 'japhy/Marillion' Pinyan [mailto:[EMAIL PROTECTED]] Sent: Friday, August 10, 2001 10:44 AM To: Jennifer Pan Cc: [EMAIL PROTECTED] Subject: Re: grep repetitive elements? On Aug 10, J

grep repetitive elements?

2001-08-10 Thread Jennifer Pan
I have two list, @list1 and @list2, each element @list1 is unique (could be a hash I suppose) I want to find out all the elements @list2 that is an element in list1 and have appeared two or more times I want to use GREP but I don't know how to grep certain element only when it happens >2 times,

get rid of the same elements in an array/hash

2001-08-06 Thread Jennifer Pan
sorry to ask this as I saw the same question but cannot remember the answer. if I have a hash, how do I get rid of the elements that appear more than once? thank you very much -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

save file in an array

2001-08-01 Thread Jennifer Pan
I want to download a page, and want to save it in an array to parse it later on, I did #usr/local/bin/perl my @list; $URL1= "http://blablabla";; $command="/opt/sfw/bin/wget -nv -O @list $URL1"; system "$command"; print @list; it didn;t work. But if I say $command="/opt/sfw/bin/wget -nv -O list

RE: if in a list

2001-07-26 Thread Jennifer Pan
many thanks, jos and maxim, your suggestions were very helpful. jennifer -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

if in a list

2001-07-26 Thread Jennifer Pan
I want to test if "AF1" is in my list @mylist; I did: foreach $LIST (@mylist) { if ($LIST = "AF1") $boolean = 1; else $boolean = 0; } is there a more elegant way to do it? many thanks jennifer -- To unsubscribe, e-mail: [EMAIL PROTEC

matrix construction

2001-07-20 Thread Jennifer Pan
I download the matrix module from CPAN , http://search.cpan.org/doc/ULPFR/Math-Matrix-0.3/README, $a = new Math::Matrix ([rand,rand,rand], [rand,rand,rand], [rand,rand,rand]); , but I am still at lost as to how to construct a matrix so if I want

concatenate $FILENAME and .yyy

2001-07-12 Thread Jennifer Pan
Hello all, I stdin a file name: xxx.txt and I would like to have a output file name called x.txt.yyy This is how I do it $FILENAME = ; $output = "$FILENAME.y"; print "$output"; And the result is only .yyy How do I concatenate $FILENAME and .yyy? Thank you

open FILE problem

2001-07-12 Thread Jennifer Pan
Hello all, I came across this problem opening up files that are fed in from command line using "ls". I do not know why this script did not work. Appreciated any input. #!/usr/local/bin/perl # I am trying to feed all the files in this directory to do text processing and save the processed txt i