Re: problem with foreach and while with array

2002-08-28 Thread Connie Chan
> > Wonder if someone could help me, I am trying to write > a script to pulls out all the machine names from a > revese DNS file, some how, my script will only print > out the machine names with 1.x.x.in-addr.arpa > > $nslookup = '/usr/local/bin/nslookup'; > $dig = '/usr/local/bin/dig'; >

Re: Exported Vars

2002-08-28 Thread Connie Chan
Thanks everybody, I've learn quite a lot in this lesson again. Anyway, I still not up the OO level in Perl, so, quite sort of information here I still need sometime to digest. Here is something I've simply test, but not confirm they are right or not. When I pick up an exported vars from a pac

Exported Vars

2002-08-26 Thread Connie Chan
In package A, I did sth like this : package A; use strict; require Exporter; our @ISA = qw (Exporter); # What this actually for ?! our @EXPORT = qw (%hash); our %hash ; # code code code code and code . # Do sth to assign values for %hash anyway 1; Then , in the main script, I will use A,

Re: use Variable as a hashname?

2002-08-26 Thread Connie Chan
$x = 'key'; %Y = (); $Y{$x} = 10; print $Y{key}; # You got 10; Rgds, Connie - Original Message - From: "Angerstein" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, August 26, 2002 7:33 PM Subject: use Variable as a hashname? > Hello, > can I / how can I use a variable

Re: Can I add a path to @INC

2002-08-21 Thread Connie Chan
- Original Message - From: "Brian Oh" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, August 22, 2002 2:45 PM Subject: Can I add a path to @INC > Hi > I am using solaris and perl5.6.1. > And I got an error saying it can not locate TK/ListBox.pm in > @INC. 1. Are you sure y

Re: browser redirect

2002-08-21 Thread Connie Chan
- Original Message - From: "zentara" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, August 21, 2002 9:14 PM Subject: Re: browser redirect > On Tue, 20 Aug 2002 15:25:41 -0700 (PDT), [EMAIL PROTECTED] (Dave > Smith) wrote: > > >I'm trying to write a program that will redi

Re: Help!! Retrieving Image File

2002-08-21 Thread Connie Chan
[.] > > #!/usr/local/bin/perl -w > use strict; > > open IMAGE, 'test.jpg' or die "Failed to open image $!"; > my $buf_chunk_size = 1024 * 16; > my $buffer; > binmode IMAGE; > binmode STDOUT; > > print "Content-Type: image/jpeg\n\n"; > print $buffer while read IMAGE, $buffer, $buf_chunk_siz

Re: need help extracting words from a string - Thanks and need more help

2002-08-21 Thread Connie Chan
> Is it possible to test if a hash variable is set? My thinking is something kinda >like this: > > if ( $hashname[variable] ) { > do something smart again ; > } that's $hashname{variable}, not [variable]... Yes, you can do that, but if you also turned on warnings, you will receive a war

Re: Help!! Retrieving Image File

2002-08-21 Thread Connie Chan
No... I believe. I've digging on this topic for very very long time on my Win32, Sambar and Apache server. I can't print any image out without \r\n\r\n, where \n\n is for text file only. Why? I don't know =) Guess, because \r\n is for *binmoded data*. And without binmode STDOUT and IMAGE both.

Where to start ? Listening to a port ...

2002-08-21 Thread Connie Chan
I am working on a Win32 system, what now I am to do is checking and blocking spams on my mail server. Recently, I use a software mail server to receving mails, but, there is not filter features. What my approach is to write my own mail server. So can block address, or matched content pattern immed

Re: Global variables

2002-08-21 Thread Connie Chan
I learnt something about this for days only, so don't know if there are bugs here : # Create a package glob_vars.pm # package glob_vars; require Exporter; our @ISA = qw (Exporter); our @EXPORT = qw (%VARS) our %VARS = (); $VARS{sth_a} = 'sth_a'; $VARS{sth_b} = 'sth_b'; 1; # End of package # #

Re: Is it legal ???

2002-08-19 Thread Connie Chan
Maybe you can refer to use vars ( perldoc -m vars). Rgds, Connie - Original Message - From: "A Taylor" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, August 20, 2002 4:23 AM Subject: Is it legal ??? > Hi all, I am trying to declare some variables and was wondering what th

Re: How do you print 'C:\' ?

2002-08-18 Thread Connie Chan
[...] > backslash (else how would you embed a '?) > [...] Ooo... right!! Thaz the point, Thanks alot =) Rgds, Connie -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

How do you print 'C:\' ?

2002-08-18 Thread Connie Chan
I wonder why ... I can't write a line like this : print 'C : \ '; but have to : print 'C : \ \ '; however, I can : print 'C:\A_Dir\B_SubDir'; The last ' is escaped, why ?? Rgds, Connie -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: how to make a regex for a ip address

2002-08-18 Thread Connie Chan
Emmm... So do you want to do it in 1 line or your just want to try on ? For me, it seems quite non-effective & impossible with one line... but breaking them into pieces, that becomes handy. I use this : my $ip = $ENV{REMOTE_ADDR}; my $error = 0; my @seg = split /\./, $ip; $error = 1 unless ($

[OT] Apologize to Kevin Meltzer

2002-08-17 Thread Connie Chan
First, thanks Kevin reply me in private, with a nice (plus some unavoidably feeling) tone. (Wow... he's really the police of this list!!! I stepped on a lion's tail!! What a shock!) After re-re-read for Kevin's email, I've learnt something more about this list's culture again. Thanks Kevin re-

Fw: Help!! Retrieving Image File

2002-08-17 Thread Connie Chan
t; print "Content-type: image/jpeg\r\n\r\n"; # or try : print "Content-type: image/x-jpeg\r\n\r\n"; > while(){ > print; > } > # Try : print $buffer while (read (IMAGE, my $buffer, 1024)); # Remember to : close (IMAGE); Rgds, Connie > > > > Connie Chan &

Re: another reg needed

2002-08-16 Thread Connie Chan
) = ($1, $2) if ( /^[^\d]+(\d+)[^\d]+(\d+)$/); but of cause : ($row, $col) = /(\d+)/g ; # is much much better. Rgds, Connie - Original Message - From: "Nikola Janceski" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; "Connie Chan" <[EMAIL PROTECTED]>;

Re: another reg needed

2002-08-16 Thread Connie Chan
> $_ = "Die,Row 0, Column 12" do you trying to get this ? my ($row, $col) = ($1, $2) =~ m/^.+(\d+).+(\d+)$/; # $row = 0; # $col = 12; /^ means beginning of line ..+ means anything \d+ means 1 more more digit numbers (xxx) capture matched values within blankets in order to $1, $2...$x. $/ means

Re: How fatalsToBrowser works ?

2002-08-16 Thread Connie Chan
So, you are cross posting now! Never ever do this if that's not CGI related to CGI, and not to Perl to either any of them. If you don't understand, please read the FAQ. In case, I can't assume the subs.ers are subs. on both group, but my question is related to both on CGI issues and Perl issues.

Re: Help!! Retrieving Image File

2002-08-16 Thread Connie Chan
Yes, you forgot to post your code =) Rgds, Connie - Original Message - From: "Archie" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Friday, August 16, 2002 9:11 PM Subject: Re: Help!! Retrieving Image File > Thanks 4 replying Connie, but i

How fatalsToBrowser works ?

2002-08-16 Thread Connie Chan
I am on a Win32 system, and I use the fatalsToBrowser to prompt errors with some scripts. However, the error mesg will also prompt where exactly the file(script) is located. In case, I don't want the full path is exposed. Can I modify sth , perhaps regex s///, to mask the root path ? like : Fil

Re: Help with regular expressions

2002-08-16 Thread Connie Chan
- Original Message - From: "pn" <[EMAIL PROTECTED]> To: "prl_list" <[EMAIL PROTECTED]> Sent: Friday, August 16, 2002 7:24 PM Subject: Re: Help with regular expressions > > > I ran into the following Regular expressions, but am > unable to quite understand what each of these mean: > > An

Re: errrorrrrrrr

2002-08-16 Thread Connie Chan
- Original Message - From: "Javeed SAR" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, August 16, 2002 6:44 PM Subject: errrorrr > hi, > > > What i am doing in this script, if .vbp or .dsp exists the $counter should > be incremented. > If $counter >=1 it should say the

Re: BEGIN statement in Perl?

2002-08-15 Thread Connie Chan
#! perl use strict; our $static = 'a,'; sub a { $static .= $static } sub b { $static .= $static } sub c { $static .= $static } sub d { $static .= $static } print a(); # a, print b(); # a,a, print c(); # a,a,a,a, print d(); # a,a,a,a,a,a,a,a, First, I would like to ask, is that a static var mea

Re: writing short code to perform same?

2002-08-15 Thread Connie Chan
Oops... so the OP just need this ?? I still can't read the logic, but : # perl use strict; my $line="abcdefgh"; print "Outline 1: $line\n"; for my $cut (2 .. length($line)) { my @round = $line =~ /(?=(.{$cut}))/g; print "Outline $cut: @round\n"; } Can do the same =) Rgds, Connie - Orig

Re: writing short code to perform same?

2002-08-15 Thread Connie Chan
> how do i solve this? > > my $line="abcdefgh"; > > i want output which has 8 lines: > 1st outline: abcdefgh > 2nd outline:ab bc cd de ef fg gh > 3nd outline:abc bcd cde def efg fgh > 4th outline...so on > But what is "so on" ? Is that the 4th line like abcd bcde, but what next? I can't re

Re: Executing script "invisibly"

2002-08-14 Thread Connie Chan
- Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, August 15, 2002 3:56 AM Subject: Executing script "invisibly" > Hello, > I am using Javascript (body onload) to execute a script automatically as a page >loads, but this ends up redirecting the page

Re: scripting .pl files in Windows

2002-08-14 Thread Connie Chan
> As it stands now, all my .pl files are associated with ActiveState perl. > When i double click on them, the perl window opens and displays the output > for only a fraction of a second before it closes. I suggest you better associate your perl script with a text editor rather then the perl.exe.

Re: Help!! Retrieving Image File

2002-08-14 Thread Connie Chan
> Code 1: It didnt work... > > #!/usr/bin/perl > > use CGI; > $query = new CGI; > my $filepath='/home/myaccount/uploads/laptop.jpg'; > > print $query->header('image/jpeg'); > print $filepath; > Of cause, you didn't open the file and read the file. You are trying to print "/home/myaccount/upl

Re: Quick regexp help!

2002-08-13 Thread Connie Chan
> how do i only get the first part from this? > > RTFRT_flu@23460@\GE_Machine <- replica:GE_Machine_KI@\GE_Machine > > i get this value in $_, now i want to remove anything that is after <- including the >arrow >>>(what i want is: RTFRT_flu@23460@\GE_Machine) The arrow may point in the other di

Re: Installing .pm's

2002-08-12 Thread Connie Chan
In your Dos shell, or Start->Run : ppm ppm3 ( better I guess ) Rgds, Connie - Original Message - From: "Scott Barnett" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, August 13, 2002 2:31 AM Subject: Installing .pm's HI, I am new at perl and was wondering what is best w

How to give a name for a file?

2002-08-11 Thread Connie Chan
I have a script that read and then print a binary file on runtime, which actually mean to a file is for download. I mean, not like this : Download. However, I don't know how to give a name for the file. I've use this header : print "Content-type: audio/mp3\r\n\r\n"; and my script 's name is d

Re: Array

2002-08-11 Thread Connie Chan
I hope that's what you want : #FILEB.pl use strict; use warnings; my $fileA = 'somewhere'; open (FILE_A, "$fileA"); my @DirList = ; ## So read all line close (FILE_A); foreach my $dir (@DirList) { chomp $dir; # chomp : This might be not nesessary, I don't know, # but this is

Re: Sorting a list by...

2002-08-10 Thread Connie Chan
[] [] > or die "Couldn't open $log!"; > while ($line = ) { > if ($line =~ /byte/i) { print $line } > } > close (FILE); Hi all, for the above lines. I guess the OP gentleman is not dealing with a 1GB log for what he asked. He had writtern something for picking up those lines

Re: Spreadsheet::ParseExcel

2002-08-04 Thread Connie Chan
Have you check those related modules are installed ? IO::Scalar OLE::Storage_Lite Seems the problem starts from IO::Scalar, try to upgrade or remove and install it again Rgds, Connie - Original Message - From: "Hytham Shehab" <[EMAIL PROTECTED]> To: "perl" <[EMAIL PROTECTED]> Se

Looking for multi platform to test my script.

2002-08-03 Thread Connie Chan
Now, I am working on a Win32 OS, scripts here seems working fine. But I hope to test my scripts on a *nix system too... Could you suggest me where to have a free account to run CGI (better can use most of standard modules with Perl too) ? Rgds, Connie -- To unsubscribe, e-mail: [EMAIL PROTECT

Re: Sort table with dynamic order of fields [Part 1]

2002-07-31 Thread Connie Chan
> Using parallel arrays to store related data is not a good idea imho. I wanna ask for long... so what is IMHO and RTFM ?? > I would use an (anonymous) array of hashes here: > > my $persons = [ { ID => 'Foo', COUNTRY => 'UK', GENDER => 'F' }, > { ID => 'Bar', COUNTRY =>

Re: Editor

2002-07-31 Thread Connie Chan
Me too !! This editor is the greatest I found on Win OS. But have you download the Syntax pack for Perl ? Go ahead if no. Anyway, the other choice for me is Note Tab Lite. But seems very unstable if I am using Chinese ( Perhaps that do not have any infect on you ). But if you are doing a global

Re: Sort table with dynamic order of fields

2002-07-31 Thread Connie Chan
> Are you sure it's a HashOfArrays and not an ArrayOfHashes? > > #HAO > > $data{$key} = ['Jenda', 'Krynicky', '[EMAIL PROTECTED]', ...] > > # AOH > $data[$i] = {fname => 'Jenda', lname => 'Krynicky', email => > '[EMAIL PROTECTED]', ...} > What I have now is something like this : @ID = qw (Foo

Re:chr help

2002-07-31 Thread Connie Chan
> I have a subroutine that finds commonly found Unicode characters that > Microsoft Word uses (such as "smart quotes") and converts them to plain > ASCII text. However, there is one character whose chr() value I can't seem > to find - the MS Word long dash, which automatically replaces the normal

Re:Perl Array Question

2002-07-31 Thread Connie Chan
> while (my @RACT_LOG_data=$sth_RACT_LOG->fetchrow_array){ > > $count_RACT_LOG_data++; > push our @KEY_SNR_RACT_LOG[$i], $RACT_LOG_data[0]; > push our @DRAWING_RE_RACT_LOG[$i], $RACT_LOG_data[1]; > push our @RCODE_ID_RACT_LOG[$i], $RACT_LOG_data[2]; >} You missed a } for the for loop or misse

Re: Sort table with dynamic order of fields

2002-07-31 Thread Connie Chan
Thanks in advise =) In case, my source is not an Excel spread sheet, but a Hash Of Array. So is that mean if I want to use this function, then I have to convert my HOA to Spreadsheet, then use the method below to sorting about ? Or anything I can do more direct ? Or anything can let me directly

Sort table with dynamic order of fields

2002-07-30 Thread Connie Chan
In Excel, there is an interesting function which can sort a table by fields with any order and hierarchy order. Is there any module can do this for whatever array of array, hash of array... etc. ? But what I am looking for is not for and related to any database. So some of DBI functions maybe n

Any better way to make 1000000 becomes 1,000,000 ?

2002-07-29 Thread Connie Chan
my $num = 100; # or whatever integer; $num = reverse($num); $num =~ s/(\d{3})/$1,/g; chop $num if $num =~ /,$/; $num = reverse($num); print $num; I have this script to make an integer with comma at every 3 digits, from right to left. (What should this presentation way name actaully ?? ) Li

Re: Calculate previous hour?

2002-07-29 Thread Connie Chan
@tm = localtime(time); $hour = $tm[2] - 1; $hour = 23 if $hour < 0; $hour = '0'.$hour until length($hour) == 2; print $hour; Rgds, Connie > > Basically I just want to find the previous hour in one of my scripts. > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mai

Re: Renaming a File in Win32.

2002-07-29 Thread Connie Chan
If you are using a Apache server on Win32, the log file will be LOCKED during its running. So you cannot rename, unlink or open for edit on it. you can only open it for read only. Maybe you can copy, I don't know. rename ($file, $newfile) or die ".. $!"; # may help to see what's the problem

Re: filehandles and while loops

2002-07-27 Thread Connie Chan
Sorry, still can't get your logic... But there's a better approach here : open COUNT,"count.dat"; # ./ mean current dir, so, it's not nessary open TEMP, "temp.dat" ; Then , for the entire loop, you can read from COUNT, and write to TEMP. At last, unlink the COUNT file, then rename the temp.dat

Re: Syntax Culture

2002-07-27 Thread Connie Chan
> > These are all expressions: > 1 > 1 + 2 > $x * 2 > foo(1,2,3) + 49 > (1,2) x 2 > $x == $y > $x < 5 > $x > 1 && $x < 5 > but even this is an expression: > $x = $y + 2 > > Basicaly "expression" is something that creates a value that you can > assign to a variable, pass to a function or use as

Re: filehandles and while loops

2002-07-27 Thread Connie Chan
> > sub count { > > open (COUNT, "+>./count.dat") or die "cannot open countfile: $!"; > > flock(COUNT, 2); > > > > while (){ > > if (m/BC0012/i){ > > ($key, $count) = split('=',$_); > > $found = 1; > > $count++; > > } else { > >

Fw: Advice

2002-07-27 Thread Connie Chan
Of cause, Cookies can help, if you want some modules can deal with cookies, look at : http://search.cpan.org/search?mode=module&query=Cookies But how to let the cookies becomes a reliable issue, that depends how you design on it. But the concept on using cookies is somewhat talking about GET some

Re: A basic question about arrays

2002-07-26 Thread Connie Chan
[] > -My Response- > > If you only want to go through the file once, it may not make sense to go to > the trouble of creating a hash. Bottom line is that you probably want > something like this: > > # loop through the file line by line > while () { > # strip the trailing newline fro

How to throw 1 more hash or array to a sub ?

2002-07-26 Thread Connie Chan
Would anyone tell me how to do something like this ? sub something {my (%hash, %hash2, @array) = @_; [..] return (%result) } my %restult = something ( %hash, %hash2, @array); -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: strange GMT Time

2002-07-26 Thread Connie Chan
> > I use Perl gmttime() to obtain UTC Time (formerly > known as GMT Time) and unfortunately, value returned > does not match official UTC time format: > > Official UTC Time Format = YYMMDDHHMMZ > > and here is what I get from gmtime() API= > 7321826610252060 > This is how many seconds pasted

Re: dividing the string

2002-07-26 Thread Connie Chan
> If I have this string: > > $currYear = 2002; > > How can I remove first two digits? > I guess that's not a right way, but for this attemp, you can try : $currYear =~ s/\d{2}(\d{2})/$1/; Rgds, Connie > Thank you! > > __ > Do You Yahoo!? > Ya

Re: How to throw 1 more hash or array to a sub ?

2002-07-26 Thread Connie Chan
> > @carryBack = $@something; > $elems = $#carryBack; > Sorry everybody... I know scalar(@array) and $#array's different... I do this just normally, I like to count from 0 as well.. so I treat the elems like this... What I am trying to ask is when this happen... sub something {my ($hash,

Re: Syntax Culture

2002-07-26 Thread Connie Chan
> > For the 'bare bones' information read > > perldoc perlsyn > perldoc perlop > > For the more abstract questions > > perldoc perlstyle > Thanks alot ! They are shooting to what I am wondering about.. But it raise me another question... How can I perldoc at html format/

Re: Syntax Culture

2002-07-26 Thread Connie Chan
> > perldoc perl - will get you into the start of it... > > 3rd Edition of perl programming - is a lovely book that > goes into detail about most of the elements... the pocket > guide offers a short list of them Do you mean the Camel Book ? I have one, but Chinese, would you point me to the cha

Re: Total newbie. Window handling WIN32

2002-07-26 Thread Connie Chan
> How do I send output to a specified window other than the one I run my > script from? > > For that matter how to I specify which window anything happens in other > than the window I run my script from? > Perl don't handle this. You'll do this with HTML or Javascript. ... ... Rgds, Connie

Re: Displaying IP address.

2002-07-26 Thread Connie Chan
print $ENV{REMOTE_ADDR}; you may dig out some more about the client and your server by this : foreach my $key(keys(%ENV)) { print "$key = $ENV{$key}\n" } Rgds, Connie - Original Message - From: "Vishal Kapoor" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, July 26, 2002 1

Re: function for finding the index of an element in an array?

2002-07-25 Thread Connie Chan
Ooops... =) I 've posted the bug version, which should set the beginning with -1. Thanks for remind =) Rgds, Connie - Original Message - From: "Kay Bieri" <[EMAIL PROTECTED]> To: "Connie Chan" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Se

Re: function for finding the index of an element in an array?

2002-07-25 Thread Connie Chan
Right! I have the same idea as you, and I have this : my @list = ('1234', '4567', '789A', 'BCDE', 'FGHI'); my $GetLocation = 0; my $value = 'BCDE'; for (my $atLoc = 0; $atLoc <= $#list and ! $GetLocation ; $atLoc++) { $GetLocation = $atLoc if ($value eq $list[$atLoc]) } And I finally got t

Re: del files

2002-07-25 Thread Connie Chan
way, anybody in list can tell ? 2. in the unlink loop [...] print "\"$_\""; [...] Rgds, Connie - Original Message - From: "Javeed SAR" <[EMAIL PROTECTED]> To: "Connie Chan" <[EMAIL PROTECTED]> Sent: Thursday, July 25, 2002 7:15 P

Re: del files

2002-07-25 Thread Connie Chan
> What about if there r space in file names? There is no problem for unlink to handle filename with spaceS. The issue is on how you get the file list to the array. Rgds, Connie > > > -Original Message----- > From: Connie Chan [mailto:[EMAIL PROTECTED]] > Sent:

Re: del files

2002-07-25 Thread Connie Chan
for (@privates) { chomp; print "Attemp to del $_\n"; unlink ($_) ? {print "$_ unable to del" } : {print "$_ deleted" }; } I didn't ever tried unlink @array like method, perhaps the problem is there. and you got 0 delete is the "fail signal" send back from the unl

Fw: Checking if a file is downloading

2002-07-24 Thread Connie Chan
> Content-type: application/octet-stream > Content-Disposition: attachment\; filename=$file This seems IE way, if I don't remember it wrongly, this does not work at NS Anyway, how about this ? $| = 1; my $file = 'yourfile.ext'; print "Content-type: application/(your file type)\r\n\r\n";

Re: PM installation problem

2002-07-24 Thread Connie Chan
om: "Akens, Anthony" <[EMAIL PROTECTED]> To: "Connie Chan" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Thursday, July 25, 2002 12:26 AM Subject: RE: PM installation problem If you're using activestate perl on your windows box, just use ppm. Just

That seems interesting ? but I don't know why ?

2002-07-24 Thread Connie Chan
In normal case, when we want to swap 2 var, , say $x and $y, we do in this way : $z = $x; $x = $y; $y = $z; # Swapped today, I suddenly found a code like this : $x ^= $y ; $y ^= $x ; $x ^= $y; # Swapped It works !! but how that works ? Could anybody tell me ? Rgds, Connie -- To unsubscr

PM installation problem

2002-07-24 Thread Connie Chan
I 've just downloaded a "Imager" module, however, that's a .tar.gz file and I am using Win Me. After I extract the file, there are quite sort of files and dirs. So... how can I install it to my Perl lib or site/lib ? Rgds, Connie -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional com

Re: Remove 4 last letters

2002-07-23 Thread Connie Chan
> > > $variable =~ s/\S\S\S\S$//; Heehee.. just for fun, what about if $variable = "123456\t8\t0" ? =) Rgds, Connie > > > John > -- > use Perl; > program > fulfillment > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- To

Re: Remove 4 last letters

2002-07-23 Thread Connie Chan
$var =~ s/.{4}$//; Rgds, Connie - Original Message - From: "David Samuelsson (PAC)" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, July 23, 2002 8:00 PM Subject: Remove 4 last letters > This should be really simple, just use a regexp to remove the 4 last letters from a >v

Re: Regular Expression Problems?

2002-07-19 Thread Connie Chan
Maybe, you can try simplier test at beginning... it 's diffictuly for you to track down what's wrong with your code, since you still not yet turn on strict and warnings. maybe typing error, maybe syntax error, you don't know unless you use strict, and use warnings. Your example is including , cho

Re: Script advice

2002-07-19 Thread Connie Chan
> > open MYMESSGELOGFILE, "< /var/log/messages"; > open MYSECURELOGFILE, "< /var/log/secure"; > > my @messageLog = ; > my @secureLog = ; So you have to something here to track on the log's date, and re-construct the array Regex and shift( ) maybe help on th

Re: Pattern-Matching var - interpolation.

2002-07-19 Thread Connie Chan
I suggest you better put all the "keywords" in array , then use a loop to handle it... my $hund= "hund m-a-u-s katze k.a.t.z.e. maus xyz 1234"; my @dings = ("hund", "Sudarshan", "m-a-u-s", "k.a.t.z.e.", "xyz", "Connie", "123") ; for (@dings) { if ($hund =~ /$_/) { print "'$_' found at hund\n"

Re: Mail::Mailer

2002-07-19 Thread Connie Chan
If just a simple mail, you can try Net::SMTP, if with attacaement, you can try Mail::Sender Rgds, Connie - Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, July 19, 2002 4:02 PM Subject: Mail::Mailer > Hi > > I am having trouble locating the module Ma

Re: Chopping a string.

2002-07-19 Thread Connie Chan
$line =~ s/^(.{20}).+/$1.../ ; Rgds, Connie > > > Hi all, > > > > > > I have a string $line that can be a short word or a very long > > > line, and I > > > want to cut it if it is longer than 20 characters, then to > > > end it with > > > Is there any Perl function for chopping what is

Re: Opening and Writing to Files

2002-07-18 Thread Connie Chan
>> print (@contents); You have to print to the file handle, otherwise, nothing will write to WRITEFILE, but to screen only. So, you have to write as : print WRITEFILE @contents; >> @newcontents = ; >> print "\n The contents of writefile.txt is $newcontents \n"; No, $newcontents here will prin

Re: How to get folder name of current script running?

2002-07-18 Thread Connie Chan
Dose $0 the thing you want ? Rgds, Connie - Original Message - From: "chris" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, July 19, 2002 6:26 AM Subject: How to get folder name of current script running? > How to get folder name of current script running? > > This may or

Re: maximum column length

2002-07-18 Thread Connie Chan
Maybe : round sprintf use POSIX use Math::Complex use Math::Trig I don't know which one can help, but they seems quite like what you need. Rgds, Connie - Original Message - From: "Konrad Foerstner" <[EMAIL PROTECTED]> To: "Connie Chan" <[EMAIL

Re:maximum column length

2002-07-18 Thread Connie Chan
I forward this message to the list, so hope some others can help too.. > > > to have column with the maximum lenght (in my case 580 pixels). > > > > What is length refer to ? I mean, the width or height ? > > Is this important? Well, my columns start left an go to the right side. > So this pixel

Re: maximum column length

2002-07-18 Thread Connie Chan
> to have column with the maximum lenght (in my case 580 pixels). What is length refer to ? I mean, the width or height ? > All the other values should be drawn in relation to that. So what is the relation ? Is that the "length" is $max_percent_value or what ? > I thougt I can make a factor a

Re: Can get script to print to command prompt no matter what I try

2002-07-17 Thread Connie Chan
Ooops.. is this problem still not yet solved ?! :-( Hmmm. I don't know if this is OT of not, but seems that would be a problem for Win32 beginners need to deal with If a dosprompt is too difficult to deal with, let's return to the idea of using "double click". You'll say, the scre

Re: The True Guide to Learning Perl was Re: Thank You! :)

2002-07-16 Thread Connie Chan
Hi everybody, I don't understand why you guys making things so complex. "Perl is language" and I think that should be all. :-) Whatever the habbits on Perl, is just as simple as how we learn our mother tongue. On the learning side, we began with A, B, C , while on the practical side, we b

Re: Consolidate if/else

2002-07-16 Thread Connie Chan
"Surround them"... and ... better use +ve logic : $opt_Z ? ( $mkt = $opt_Z) : ( die "Must supply Market\n" ); or $opt_Z ? { $mkt = $opt_Z} : { die "Must supply Market\n" }; Rgds, Connie - Original Message - From: "Kevin Old" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday,

Re: Can get script to print to command prompt no matter what I try

2002-07-16 Thread Connie Chan
Try the simplest : # C:\test.pl # print "hello world!\n"; ## At Dos prompt of C:\> type : perl test.pl Rgds, Connie - Original Message - From: "cory" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, July 17, 2002 11:19 AM Subject: Can get script t

Re: find biggest number (new try :) )

2002-07-16 Thread Connie Chan
@array = sort {$a <=> $b} @array; $biggest = pop(@array); - Original Message - From: "Konrad Foerstner" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, July 17, 2002 12:42 AM Subject: find biggest number (new try :) ) > > sorry a small but important mistake > > Im looki

Re: cross referencing hashes

2002-07-16 Thread Connie Chan
mp... Rgds, Connie - Original Message - From: [EMAIL PROTECTED] To: Connie Chan Sent: Tuesday, July 16, 2002 6:55 PM Subject: Re: cross referencing hashes Had a good look at this now, actually, all I need is the $diff, but the issue I guess is that the format of the time st

Re: cross referencing hashes

2002-07-16 Thread Connie Chan
but I don't know what is time stamp =) are these integers ? Would this help : my %tableA = (. ); my %tableB = (..) ; my %comp = ( ); foreach my $key(keys(%tableA)) {my $diff = $tableA{$key} - $tableB{$key}; $comp{$key} = $diff; } Is %comp the stuff you want ? Rgds, Connie

Re: Can't Get Perl to Work on Win2K PC

2002-07-16 Thread Connie Chan
> Or if you've already done that then check that perl.exe is in your PATH. > Type path at a command prompt and look for something like c:\perl\bin > > if it's not there then do > > path = %path%;c:\perl\bin > > Replace c:\perl\bin with the correct path to your bin directory > I think the OP

Re: Can't Get Perl to Work on Win2K PC

2002-07-16 Thread Connie Chan
> have you installed the perl processing language yet? you need to do that > first as the no such file or dir message is probably talking about the perl > executable, not the script. you can download avtiveperl for free from > www.activestate.com. I think the OP have installed perl, try to type

Re: require v. use

2002-07-15 Thread Connie Chan
Thousand thanks for this very valuable lesson. Some pieces of code are always better than reading 100s of docs. I am really understanding it now. My previous problem is what will be the difference of use inside require, require inside use, use inside use, and require inside require. The final ans

Re: Reading from a bunch of files.

2002-07-15 Thread Connie Chan
my @Files = ( . ); # List of file names here. my @record = ( ); my $pattern = "whatever"; foreach $file(@Files) {open FH, $file; while () { push @record, $file if ($_ =~ /$pattern/ig) } close (FH) } ## @record will probrably grabbed all the file names while con

Re: require v. use

2002-07-15 Thread Connie Chan
> When the file is included, the 'use's are executed IMMEDIATELY. The fact > that they're in functions doesn't matter. The require()s will not be > executed until (and unless) the functions they are in are called. > Thanks alot Jeff, I think I can target my question now... What I want to ask

Re: our %hash problem when require

2002-07-15 Thread Connie Chan
> >## params.pl in /lib/ ## > >my $lib{root} = 'C:/myLib/'; my $rt = $lib{root}; > >my $lib{char_maps} = $rt."chinese/gbb5.map"; > >my $lib{gb_map} = $rt."chinese/gb.map"; > > > >my $lib{temp} = $rt."temp/"; > > Warning: you cannot my() a subscript. > > my $foo[$i]; # is a syntax error

Re: require v. use

2002-07-15 Thread Connie Chan
> > As what I've learnt, 'use' is working during the compile time, > > where 'require' works at runtime, however, I have problem on > > understand this.. > > > > ### code ### > > sub A > > {my ($case) = shift; > > if ($case == 0) { require "lib0.pl" ; use somePm; use > > anotherPm

Re: our %hash problem when require

2002-07-15 Thread Connie Chan
> The "our" declaration is for the current file only, so you need > "our" in Script 1. O seems I am hopeness... > $a is a "special" variable (used in sort blocks), so it gets a > "free pass" from use strict, just like all the other special > variables ($_, $/, etc.). Was you the guy tol

Re: our %hash problem when require

2002-07-15 Thread Connie Chan
>1 Hehe... I forgot the 1; again , but I do have this in my code. =) > my $ref = \%lib1::abc; How about if I don't package it ? and hopefully just make it looks like %ENV ? For my case in real , that's something like this : ## params.pl in /lib/ ## my $lib{root} = 'C:/myLib/'; my $rt = $lib{ro

require v. use

2002-07-15 Thread Connie Chan
As what I've learnt, 'use' is working during the compile time, where 'require' works at runtime, however, I have problem on understand this.. ### code ### sub A {my ($case) = shift; if ($case == 0) { require "lib0.pl" ; use somePm; use anotherPm ; &doSth(...) } if ($case ==

our %hash problem when require

2002-07-15 Thread Connie Chan
Some days ago, I've interested in the using of 'our' var, however, I do have some problem on using this with require. ### Lib 1 ### use strict; our %abc; $abc{a} = 1; $abc{b} = 2; ### EOF Lib 1 ### ### Lib 2 ### use strict; our $a = "ME"; ### EOF Lib 2 ### ### Script 1 ### use strict; eval

Re: A localtime question

2002-07-14 Thread Connie Chan
> my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst); > ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); why not combine the 2 line as : my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); > $year+=1900; > $date = $year.$mday.$mon; > >

  1   2   3   >