Re: Does Regex help in this case ?

2003-09-07 Thread Li Ngok Lam
Thanks John, and Rob. This reply is quite close to what I am going to do, but some critical point is wanted here I'll try to explain my question further That's about the whole story, but I'll make it short. For example, I have a list like this : 123ABCDEF456 123456

Does Regex help in this case ?

2003-09-06 Thread Li Ngok Lam
Hi all, That's about the whole story, but I'll make it short. For example, I have a list like this : 123ABCDEF456 123456 654WXYZ321 987654321 ABCDEF123456 WXYZ321 By user's INTEGER input , I will have to find how many similar patterns are matched within the list according to certain chars

I don't understand why this happen

2003-08-18 Thread Li Ngok Lam
open my $fh, , items/list.db; print while ($fh); close $fh; This is suppose to printout the content in items/list.db , but why I get somthing like GLOB(0x162aca7) ?? Thanks in advise.

Re: I don't understand why this happen

2003-08-18 Thread Li Ngok Lam
my $fh; open $fh, '', 'items/list.db' or die File error: $!; It just the same as open my $fh =) print while $fh; Hmm. I guess this is not a 'read' argument Thanks in advise anyway =) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL

Re: I don't understand why this happen

2003-08-18 Thread Li Ngok Lam
PROTECTED] To: Li Ngok Lam [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, August 18, 2003 7:38 PM Subject: Re: I don't understand why this happen - Original Message - From: Li Ngok Lam [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, August 18, 2003 1:10 AM Subject: I don't

Re: Split NewLines

2003-08-18 Thread Li Ngok Lam
$string=1 blabla; When Im printing $string I get a new line between 1 and blabla, now I needt o split that.. in my($number, $real_string) = split... my($number, $real_string) = split /\n/, $string; HTH -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail:

Re: data not pushing to list

2003-08-14 Thread Li Ngok Lam
Is there any reason why this doesn't print the @missing? Ive also tried unless ($myhash{$elem} == 1) { push(@missing, $frame) } Any insight into what I'm doing wrong would be greatly appreciated. @missing = ; Wrong assignment, should be: my @missing = (); my %myhash = (); @framelist= (1,

Fw: Can Perl dealing with PID ?

2003-08-07 Thread Li Ngok Lam
Is there any module in Perl can dealing with Procession ID on Win32? And does Perll able to stop or start a services / application? Any pointers where I can start from ? Thank you very much...

Re: Simple question

2003-08-07 Thread Li Ngok Lam
You method does work ! However, you can write as : $line[1] /= 1000; # which is the same as $line[1] = $line[1] / 1000; HTH - Original Message - From: Sommer, Henrik [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, August 05, 2003 11:05 PM Subject: Simple question Hi, How do

Re: print HTML code; in NETSCAPE

2003-08-04 Thread Li Ngok Lam
You are possibly missing this line : print Content-type: text/html\n\n; HTH - Original Message - From: mario kulka [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, August 05, 2003 2:32 AM Subject: print HTML code; in NETSCAPE I'm using the following to print HTML to the

I just work this out.. but seems no point to use it

2003-08-03 Thread Li Ngok Lam
$x = sub { $y = shift; print $y }; $X = $x; $X - (123); # prints 123; undef $X; $Z = $x; $Z - (234); # prints 234 Question : 1. When will you use this kind of style in your code ? 2. Any name for this kind of coding style ? TIA

Re: Uploading files

2003-08-02 Thread Li Ngok Lam
- Original Message - From: K. Parker [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, August 02, 2003 12:00 PM Subject: Uploading files On a site I'm developing, I'm trying to create a script that uploads encrypted files and saves them in a particular directory. You will do

Re: use lib problem

2003-08-02 Thread Li Ngok Lam
- Original Message - From: awarsd [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, August 02, 2003 10:01 PM Subject: use lib problem Hi, I have a problem maybe it is normal. My problem is with using lib now to retrieve my module i do this use lib /path/to/Module; it works

Re: I'm a Nebie to PERL

2003-07-31 Thread Li Ngok Lam
I'm still puzzled as to how Kenneth managed to get a listing of his program out of a Perl command. Let us know how you're getting on Kenneth, if you're still watching this thread. Hi Rob and Kenneth, I still watching in this thread, but I am not sure did I missed something in this thread.

Re: How does CGI.pm handles Content-type: text/html\n\n ?

2003-07-30 Thread LI NGOK LAM
or not. - Original Message - From: drieux [EMAIL PROTECTED] To: cgi cgi-list [EMAIL PROTECTED] Sent: Wednesday, July 30, 2003 10:37 AM Subject: Re: How does CGI.pm handles Content-type: text/html\n\n ? On Tuesday, Jul 29, 2003, at 18:36 US/Pacific, LI NGOK LAM wrote: [..] So.. if I create my own

Re: I'm a Nebie to PERL

2003-07-30 Thread LI NGOK LAM
First, your Perl is not a complete version of Perl. You just have the compiler of Perl. You almostly missed some very important modules such as strict, warnings, CGI..etc. And second, your Perl is out of dated. for Win32 OS, Perl is up to 5.8.0 now. So go to

Re: How to read multiple files in the same time ?

2003-07-30 Thread LI NGOK LAM
: Daniela Silva - Absoluta.net [EMAIL PROTECTED] To: LI NGOK LAM [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, July 31, 2003 1:12 AM Subject: Re: How to read multiple files in the same time ? Hi, I want to do something similar, read multiple files and extract some piece of readed lines

Re: I'm a Nebie to PERL

2003-07-30 Thread Li Ngok Lam
- Original Message - From: Rob Dixon [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, July 31, 2003 5:44 AM Subject: Re: I'm a Nebie to PERL [snap] It ran and just listed the contents of the helloworld.pl file. PERL ran but the .pl program didn't. Any idea how to

How does CGI.pm handles Content-type: text/html\n\n ?

2003-07-29 Thread LI NGOK LAM
I have read throught the CGI::Carp::fatalsToBrowser... not quite understand all, but I wonder how does this script handles the Content-type: text/html\n\n.. So in the some case s(such as warnings) this header line won't re-print ? TIA

I want to confirm the figure of a form data .

2003-07-29 Thread LI NGOK LAM
While I hit the submit the Submit button on a form ( in a normal way ), my cgi script is of cause going to read the data. My question is that does the data I read are all in the same context format ? Actually my target point is about the CRLF stuff... Is that what I read are the same even I am

Re: How does CGI.pm handles Content-type: text/html\n\n ?

2003-07-29 Thread LI NGOK LAM
, and PrintContentT, it check if exists of contentype. If exists, won't priint the header again, else, print the header. Is that Okay logically ? TIA - Original Message - From: Wiggins d'Anconia [EMAIL PROTECTED] To: LI NGOK LAM [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent

Re: Error Variable in Package

2003-07-28 Thread LI NGOK LAM
Sorry I don't understand your question well, but from overall, I guess that's all about what you want... ### # Main.pl use MyGoodies; my $fedback = $MyGoodies::Error(); ### # MyGoodies.pm package MyGoodies; use strict; sub Error {check

How to read multiple files in the same time ?

2003-07-26 Thread LI NGOK LAM
How can I do this ? Or could it be done ? Open some files ( unknown number of files ), depends on users demand. Then start looking for some desired line ( use regex ). I have an array to carry the info of matched data ( from which file, which line ). while the $#array is 99 and all files would

\r\n\r\n or \n\n or \r\n or \n... What is the term / name for this?

2003-07-26 Thread LI NGOK LAM

How to pass CODE reference in hash?

2003-07-26 Thread LI NGOK LAM
I hope to design an interface of a function like this (not in OO way) : sub tell_error { print Error for @_ } sub Check_err { my %argv = @_; } Check_err ( TYPE = [1, 1, \tell_error('Type')], DATA = [ 1, 2, \tell_error ('Data')] ); In Check_err, I want tell_error ('Type')

Re: regex problem

2003-07-24 Thread LI NGOK LAM
I have a number $page = 500; now i want to check that if $page matches a word character then make $page =1; $page = 1 unless ( $page =~ /\d/ ); or $page = 1 if ($page =~ /\D/ ); so originally i did this my $page =500; if(($page =~ /\w/) || ($page = 0)){ $page=1; } print$page; \w

Re: Checking for a directory

2003-07-24 Thread LI NGOK LAM
if ( -d $path ) { print Directory } elsif ( -f $path ) { print File } else { print Not exist } HTH - Original Message - From: Rus Foster [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, July 24, 2003 8:39 PM Subject: Checking for a directory Hi All, Just trying to work out

Re: Checking for a directory

2003-07-24 Thread LI NGOK LAM
Yep ! =) Even though I can't imagine what a path is not file or directory would imply more then not exist. But I agree to check the existence for a path by -e is the safest operation. - Original Message - From: [EMAIL PROTECTED] To: LI NGOK LAM [EMAIL PROTECTED]; Rus Foster [EMAIL

Re: Checking for a directory

2003-07-24 Thread LI NGOK LAM
Thanks for this great lesson, I will take account for this on my furture =)) - Original Message - From: [EMAIL PROTECTED] To: LI NGOK LAM [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Friday, July 25, 2003 12:17 AM Subject: Re: Checking for a directory

Re: Comparing two files

2003-07-22 Thread LI NGOK LAM
First, I would ask, how many lines in each file ? under 100 ? above 1 ? because that effect to choose the tatic for making things done. Well, I assume there is reasonable to carry 1 names and each name not longer then 20 character ( consumed about 200KB, still acceptable ) and I

Re: Reg Exp Help...

2003-07-22 Thread LI NGOK LAM
- Original Message - From: [EMAIL PROTECTED] To: James Kelty [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 1:21 AM Subject: RE: Reg Exp Help... On 22 Jul 2003 09:15:29 -0700, James Kelty [EMAIL PROTECTED] wrote:

Re: print command help

2003-07-22 Thread LI NGOK LAM
- Original Message - From: Josh Corbalis [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 2:24 AM Subject: print command help I'm writing a webmin module and I'm trying to add a search function in right now but after I search for it and try to display the output

How to check data type in @_ ?

2003-07-21 Thread LI NGOK LAM
I am going to write a sub accept different types of data type. My interface is some what like this : $ret = mySub ( \%hash ); $ret = mySub ( [EMAIL PROTECTED] ); $ret = mySub ( \$calar ); $ret = mySub ( \Sub ); $ret = mySub ( $calar ); $ret = mySub ( %hash ); $ret = mySub ( @rray ); Is there

How to call / push an elem to a hash of array ?

2003-07-18 Thread LI NGOK LAM
my (%LIST, @other_list); @other_list = ( Unknown Length Data Elems ); foreach my $col (@lists) { for (@other_list) { if ( exist $LIST{$col}[0] ) { Do_smth_2 } # But ERROR either What should I write here ? So can push vars to $LIST{$col} } } Thanks in

Is there anyway to modify my bios clock by perl ?

2003-07-16 Thread LI NGOK LAM
Is there anyway to modify my BIOS clock by Perl ? and more, is there anyway to adjust my BIOS clock, so to sync. with other time servers ? TIA

How to run a shell command but not waiting for the result ?

2003-07-14 Thread LI NGOK LAM
I've tried to use exec, system, and ``. And also with and without $| = 1; but seems unable to do what I want. What I want to do is suppose like this : print Start; exec notepad; print End; but I found my results are : If I can see End, the notepad won't come, If I can run the notepad, I can't

Re: silly question

2003-07-09 Thread LI NGOK LAM
I would say the other name of socket programming is network programming. The socket modules will act as a interface to deal with other machines, such as FTP, telnet, smtp, pop, etc. I would recommand Network Programming with Perl, by Addison Weskey, but that's a book, not a site =) -

Regex or Looping problem ?

2003-06-29 Thread LI NGOK LAM
snipped some annoying code foreach my $result(@filelist) # a script snipped was given a file list { chomp ($result); my $com_result = $result; $com_result =~ s/^$root//; # $root was a defined var, where using to target the below filter focus # on the rest of

How to write to a file at certain position?

2003-06-26 Thread LI NGOK LAM
Is there any methods or documents I can refer to learn how to write a file at any desire position with any length without to write the whole again ? I mean, I dont want to write to a new file, kill the old file, rename the new file, or read the old file, modify it and rewrite the old file etc...

Re: How to write to a file at certain position?

2003-06-26 Thread LI NGOK LAM
You want seek(), and possibly tell(). perldoc -f seek Thanks for reply, but seems I have to clarify my question. 'seek' and 'tell' only helping me to target my position within a file handle. Say, if I have a 1MB file, and I just want to over write bytes from 0 to 1000 byte then my job

Re: How to write to a file at certain position?

2003-06-26 Thread LI NGOK LAM
You will probably want to open the file with a mode of +. Yes and thank you! That does what I want now. Thank you very much !! But I found new problem now. I did what I want if I try on a bitmap file, but for text file, my new contents will overwrite the whole file, what's that about or

Re: How to write to a file at certain position?

2003-06-26 Thread LI NGOK LAM
#/!perl -w use strict; use IO::File; my $offset = 3; my $file_binary = fg; sysopen(OUTFILE, out.txt, O_WRONLY) or print Couldn't open file for read/write ($!)\n; binmode OUTFILE; sysseek OUTFILE, $offset, 0; syswrite OUTFILE, $file_binary, length($file_binary); close OUTFILE;

Re: accessing the string from system(ls -al) / browse dir script

2003-04-06 Thread Li Ngok Lam
I'm trying to put the string from the system(ls -al) into a variable. @list = `ls -al`; It simply prints to the page and puts 1 in the variable. What's that mean '1' anyway ? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: random sub returns same results...

2003-04-05 Thread Li Ngok Lam
perldoc -f srand - Original Message - From: meriwether lewis [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, April 05, 2003 10:09 AM Subject: random sub returns same results... Hi Gurus! I have the following sub which creates a random string. Each time I call the sub in

Re: How to measure Array or Hash's byte size ?

2003-04-04 Thread Li Ngok Lam
the table size... Vincent -Original Message- From: Li Ngok Lam [mailto:[EMAIL PROTECTED] Sent: Thursday, April 03, 2003 5:14 PM To: [EMAIL PROTECTED] Subject: How to measure Array or Hash's byte size ? My method sounds stupid, but still works : my @array = ('123', 'abc', 'def', 1

How to measure Array or Hash's byte size ?

2003-04-03 Thread Li Ngok Lam
My method sounds stupid, but still works : my @array = ('123', 'abc', 'def', 1..9); my $len_of_array = 0 ; foreach my $elem(@array) {$len_of_array += length($elem) } print $len_of_array ; # I got '18' my %hash = (1=2, 2=3, 3=4); foreach my $key(keys(%hash)) {$len_of_hash +=

Re: How to measure Array or Hash's byte size ?

2003-04-03 Thread Li Ngok Lam
I don't know if it is better or faster, but it is shorter. :-) $ perl -le' my @array = ( 123, abc, def, 1 .. 9 ); my $len_of_array = do { local $; length @array }; print $len_of_array; ' 18 $ perl -le' my %hash = ( 1 = 2, 2 = 3, 3 = 4 ); my $len_of_hash = do { local $; length

Re: Trying to block out BGCOLOR

2003-03-21 Thread Li Ngok Lam
What about the user says : body text=#123456 bgcolor=#aabbcc or body bgcolor='#123456' or body bgcolor= red Anyway, the bgcolor can be formed or change again via javascript or CSS. I mean, blocking bgcolor in body tag cannot solve your potential problem. But you may find someway to put this in

multipart form problem

2003-03-07 Thread Li Ngok Lam
Hi all, I am totally new about CGI and Perl, and now, I've facing my first problem so hope somebody can help... I have this html code : form action=getfile.pl method=post enctype=multipart/form-data input type=file name=file input type=submit /form and I have this Perl code :

Testing.....

2003-03-07 Thread Li Ngok Lam

Testing.....

2003-03-07 Thread Li Ngok Lam