Re: My confusion about if ( /grep $desc/ )

2009-03-11 Thread Victor Tsang
kevin, To answer your question, the 'greb' in your code is just part of a string, it won't produce any effect. and if what you wish is to remove your own grep process, this command might do the trick. ps -ef | grep hald-runner | grep -v grep Tor. kevin liu wrote: Hello everyone: When

Re: can i change file content without using a temp file

2007-07-23 Thread Victor Tsang
if you want to apply this regex to a single file, using the -i option (in place editing) might be the quickest way for you. ie. perl -pe "tr/[a-e]/[1-5]/g" -i Tor. cute wrote: > Now i create a temp file to store changed content. > is there a simple way to change file content without creating

Re: about serialization

2006-11-07 Thread victor tsang
http://en.wikipedia.org/wiki/Serialization Serialization here refer to the action of translating a complex data object into a simpler format. For example, translating an array [1,2,3] into a text string "1,2,3". Tor. Practical Perl wrote: I saw a paper about DB_File, Three serializ

Re: String removal

2003-03-27 Thread Victor Tsang
$TheOriginalString =~ s/$StringOrCharToRemove//g; Tor. Christian Calónico wrote: > > Hello. > I need to know how to remove a substring from a string and a how > to remove a simple character occurrence from a string. Thanks in advance! > Christian. > > _

Re: arrays and subroutines

2003-03-16 Thread Victor Tsang
You need to pass the array to the function by reference, here's the fix. &spin([EMAIL PROTECTED]); sub spin { $arr = shift; for (; $count > 0; $count--) { push(@$arr, $start++); } } but if all you want to do is to populate your array with value between 1025 to 1035, here's a clean

Re: Copying directory structure and its content.

2003-02-19 Thread Victor Tsang
In shell, you can use cp -r or rsync I have never done such thing in perl, but this library might be what you need. http://theoryx5.uwinnipeg.ca/CPAN/data/File-DirSync/README.html Tor. Pankaj Kapare wrote: > > Hi, > > I want to copy whole directory structure and its containts(may be file and

Re: Sharing variables

2003-02-10 Thread Victor Tsang
This is what you need http://theoryx5.uwinnipeg.ca/CPAN/data/IPC-Shareable/IPC/Shareable.html Tor. dan wrote: > > Hi > > Is it possible to share variables between 2 perl scripts running as 2 > separate processes? I've looked on CPAN but can't see any names that are > obvious they do that kind

Re: Replacing a string in a bunch of files

2003-02-03 Thread Victor Tsang
Mu... I have a quicker way, try this. cat FileContainFileNames | xargs -n1 perl -pe "s/oldstring/newstring/g" -i Tor. Richard Fernandez wrote: > > I just had a situation where I needed to replace one string with another > string in 200 files. > This is what I came up with, but I know there ha

trapping errors in "use"

2003-01-20 Thread Victor Tsang
I have a piece of code which will be used in two different environment, One of the difference of the 2 system is a special library that is avaiable to only one of them. Going into the cookbook I found example 12.2 very suitable for my need. So I created the following code to test the idea #!/usr

Re: Finding IP address connected to your http server.

2003-01-17 Thread Victor Tsang
Maybe we should bring this discussion out to a more appropiate list, but anyways, have a look into this doc. http://dev.zope.org/Wikis/DevSite/Proposals/RemoteAddrAndAccelerators This is not perfertly reliable, but you might want to consider it. Tor. > > Please bear in mind that this IP addr

Re: Finding IP address connected to your http server.

2003-01-16 Thread Victor Tsang
how about using mod_status? it shows all the IP connected to the server. Tor. simran wrote: > > if (you are looking for connections that have come in over time) then > look in the log file > else if i you are looking for the ip that is current connecting to the cgi script > you c

Re: The number of elements in an array

2003-01-16 Thread Victor Tsang
for ($x=0; $x < scalar(@amen); $x++) Tor. Robert Monical wrote: > > Hello, > > I'm away from my Perl book and hope one of you will help me. > > Would somebody please remind me how to make this line work > > for ($x=0;$x<$#{@amen};$x++){ > > right now, the loop only executes once. >

Re: Check if a hash is empty

2003-01-10 Thread Victor Tsang
if (%hash){ $ do } Tor. "NYIMI Jose (BMB)" wrote: > > Hello, > > If(keys %hash){ > #do ... > } > > Could you suggest an other way, please ? > > Thanks in advance. > > José. > > DISCLAIMER > > "This e-mail and any attachment thereto may contain information which

Re: hash & arrays

2003-01-09 Thread Victor Tsang
you second @EXPORT_OK= statement reset the EXPORT_OK array, I believe the correct syntex should be. our @EXPORT_OK = qw(@T_AREA %T_IDS); Tor. Jerry Preston wrote: > > Hi!, > > I do not understand what I am doing wrong. I can pass an hash this way and > not an array using the following: > >

Re: bandwidth restricting

2003-01-09 Thread Victor Tsang
If you have a linux box, It might be a better idea to employ the traffic shapper that comes with the linux kernel instead. Tor. mod_perl wrote: > > hi all, >In my Lan I have a linux proxy .How can i restrict the bandwidth > cosumed by each user using perl .Which module i can use . >

Re: Reading config files

2002-11-01 Thread Victor Tsang
build a pm to store them. Tor. Brian Ling wrote: > > Hi All > > I have a main Perl program that needs to read in a config file that just > sets some variable values, what is the best way to do this. The config > file can be in any format I want such as: > > #!/usr/bin/perl > my $var = 3; > m

comment on CGI-SpeedyCGI

2002-10-01 Thread Victor Tsang
Just saw this package on the Oct-2 UsePerl newsletter, would anyone who tried this share some comment on it? how is the performance compare to a mod_perl setup? Thanks. Tor. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]