Unitialised value in String

2006-10-23 Thread Richard Luckhurst
Hi All I am a perl newbie. I have a small perl script that is actually a cgi-bin script. I am told that until a recent server change over it ran fine however now it produces no output. I have tried running it from a command line and redirecting the input it would have received as a cgi-bin script

Re: count the characters between the matches

2006-10-23 Thread Jeff Pang
> I'd like to know how many characters there are between the first and the >last "yes". The way I now come up with to do this is to use substitution to >"mark" the first and the last match, then use a counting loop to calculate >the characters..rather straightforward and stupid method. I t

Re: count the characters between the matches

2006-10-23 Thread Chris Charley
- Original Message - From: ""zhihua li"" <[EMAIL PROTECTED]> Newsgroups: perl.beginners To: Sent: Monday, October 23, 2006 9:05 PM Subject: count the characters between the matches hi netters, I'm curious if there's any smart code to calculate the "distance" between the matches in

Re: count the characters between the matches

2006-10-23 Thread John W. Krahn
zhihua li wrote: > hi netters, Hello, > I'm curious if there's any smart code to calculate the "distance" > between the matches in a text. > Suppose I have a text like this: > syhk...yes...uhg;ka=...yes...yiealg.yes...ghe;a...yes... > Apparently it has multiple words of "yes". I'd like t

RE: count the characters between the matches

2006-10-23 Thread bou, hou \(GE Money, consultant\)
How about this . $str = 'syhk...yes...uhg;ka=...yes...yiealg.yes...ghe;a...yes...'; $count = $str; $count = $count =~ s/yes//g; print "$count\n" -Original Message- From: zhihua li [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 24, 2006 10:05 AM To: beginners@perl.org Subject: c

count the characters between the matches

2006-10-23 Thread zhihua li
hi netters, I'm curious if there's any smart code to calculate the "distance" between the matches in a text. Suppose I have a text like this: syhk...yes...uhg;ka=...yes...yiealg.yes...ghe;a...yes... Apparently it has multiple words of "yes". I'd like to know how many characters there

Re: Dynamical our/my/local

2006-10-23 Thread Jenda Krynicky
From: "Oleg V. Volkov" <[EMAIL PROTECTED]> > "Dr.Ruud" <[EMAIL PROTECTED]> wrote: > > Provide code, so we can guess better. > > Here's example how I use it in functions: > > sub add_service{ > our($login, $type_id, $account_id, $ap_id, $rule); Please DON'T! You DO want to use my ($log

Re: perl script load module as root ?

2006-10-23 Thread Tom Phoenix
On 10/23/06, Michael Gale <[EMAIL PROTECTED]> wrote: Is there a way that perl can load a module as root ? or somehow sudo with in it self to use the module ? Not like you're thinking. Sorry. One way around the problem is to make a privileged daemon which can update the tables (or whatever is

Re: Evaluation of ++ different in C and perl?

2006-10-23 Thread OROSZI Balázs
In the C language what the debate is about is clearly: UNDEFINED. Java works deliberately DIFFERENTLY, it enforces a predictable sequence. I think in Perl, the outcome is also UNDEFINED (as Mr. Jay already said). I presume the Perl language acts here just as C. It is pointless to argue about or

perl script load module as root ?

2006-10-23 Thread Michael Gale
Hello, I have a perl module that updates iptables using the IPTables::IPv4 module. Now currently we have a service that runs as a non-root user and we would like to plug our perl module into this service so the server can change iptable rules. However to use the IPTables::IPv4 module I be

Re: Evaluation of ++ different in C and perl?

2006-10-23 Thread Rob Dixon
Jay Savage wrote: > On 10/20/06, Rob Dixon <[EMAIL PROTECTED]> wrote: >> Paul Johnson wrote: >> > >> > On Fri, Oct 20, 2006 at 10:56:09AM +0200, Dr.Ruud wrote: >> > >> >> Norbert Preining schreef: >> >>> >> >>> Dr.Ruud: >> >> $ perl -wle ' >> $a = 3; >> $b = 0 + (++$a) +

Date:Calc and Bit::Vector compilation problems on 64 but linux

2006-10-23 Thread Igor Nikolic
Hello list, I have a question on compilation problems for Date::Calc on a 64 bit RHEL machine. When I use cpan to install Date::Calc and Bit::Vector I get the following problem : gcc -shared Calc.o DateCalc.o -o blib/arch/auto/Date/Calc/Calc.so /usr/bin/ld: skipping incompatible /usr/lib/

Re: Non-blocking write to FIFO

2006-10-23 Thread Peter Daum
... in the meantime, I discovered a solution, so let me answer my own question in case somebody else stumbles on this. Peter Daum wrote: > I am trying to figure out a way to write data to a fifo without > knowing whether there is a reader available and without ever blocking. > What I'd like is som

Re: Re: unique hash keys

2006-10-23 Thread Romeo Theriault
On 10/23/06, Adriano Ferreira <[EMAIL PROTECTED]> wrote: On 10/23/06, Romeo Theriault <[EMAIL PROTECTED]> wrote: > Thank you Adriano, that works nicely after I added: > > use Memoize::AnyDBM_File; > > before that I was getting this error: > > AnyDBM_File doesn't define an EXISTS method at I

Re: Evaluation of ++ different in C and perl?

2006-10-23 Thread Jay Savage
On 10/20/06, Rob Dixon <[EMAIL PROTECTED]> wrote: Paul Johnson wrote: > > On Fri, Oct 20, 2006 at 10:56:09AM +0200, Dr.Ruud wrote: > >> Norbert Preining schreef: >>> >>> Dr.Ruud: $ perl -wle ' $a = 3; $b = 0 + (++$a) + ($a++); print "b=$b\n"; ' b=8

Re: unique hash keys

2006-10-23 Thread Adriano Ferreira
On 10/23/06, Romeo Theriault <[EMAIL PROTECTED]> wrote: Thank you Adriano, that works nicely after I added: use Memoize::AnyDBM_File; before that I was getting this error: AnyDBM_File doesn't define an EXISTS method at I had not payed much attention to the fact that your code were using

Re: unique hash keys

2006-10-23 Thread Romeo Theriault
On Oct 23, 2006, at 8:45 AM, Adriano Ferreira wrote: On 10/23/06, Romeo Theriault <[EMAIL PROTECTED]> wrote: This all works fine, but in the last step of the program I am trying to get the program to tell me key's that are unique to only the first hash. No matter what I do it always prints out

Fwd: reg expression again

2006-10-23 Thread Anshul Saxena
-- Forwarded message -- From: Anshul Saxena <[EMAIL PROTECTED]> Date: Oct 23, 2006 8:38 AM Subject: Re: reg expression again To: chen li <[EMAIL PROTECTED]> You should try : my $file_name =~ /^(OT).*(\d+$)/ The caret ^ when outside any brackets, indicates that the character you a

Re: Non-blocking write to FIFO

2006-10-23 Thread Tom Phoenix
On 10/23/06, Peter Daum <[EMAIL PROTECTED]> wrote: I am trying to figure out a way to write data to a fifo without knowing whether there is a reader available and without ever blocking. Although you could use the four-arg select() to detect ready-to-write, there's no way to avoid filling the b

Re: Non-blocking write to FIFO

2006-10-23 Thread Jeff Pang
>Unfortunately, the open fails unless there is somebody reading from >the fifo- It is possible to open a fifo for read without blocking, but >I couldn't find any way to do this for writing. For reading, it also >seems to be possible to ge a signal if data is available, but I can't >think of any wa

Re: MP3::Tag and Reading values from a Hash

2006-10-23 Thread Gav Ford
xavier mas wrote: to assing values to a (key of ) hash do as: $hash_name{$key_name} = $value_name. to read same pair key/value use each function into a while loop: while (($key_name, $value_name)) = each %hash_name). sign % indicates the whole hash. Thanks for the help, I"m sorry if I'm a

Re: unique hash keys

2006-10-23 Thread Adriano Ferreira
On 10/23/06, Romeo Theriault <[EMAIL PROTECTED]> wrote: This all works fine, but in the last step of the program I am trying to get the program to tell me key's that are unique to only the first hash. No matter what I do it always prints out all of the values in the first hash, not the keys that

Re: Dynamical our/my/local

2006-10-23 Thread Oleg V. Volkov
"Dr.Ruud" <[EMAIL PROTECTED]> wrote: > Provide code, so we can guess better. Here's example how I use it in functions: sub add_service{ our($login, $type_id, $account_id, $ap_id, $rule); # Here we do some universal sanity checks for all add_* functions attr({ croak_wrong_args(@_) }); print "A

unique hash keys

2006-10-23 Thread Romeo Theriault
Hi, I'm playing with hashes trying to get myself more familiar with them. I have a little program below that has a hash with some keys and values in it. The program then copies some of the values/keys to another hash depending on their values. This all works fine, but in the last step of th

Non-blocking write to FIFO

2006-10-23 Thread Peter Daum
Sorry, this probably really is more a general unix/linux problem than a perl issue but I couldn't find any more suitable place to ask: I am trying to figure out a way to write data to a fifo without knowing whether there is a reader available and without ever blocking. What I'd like is somthing li

Re: Evaluation of ++ different in C and perl?

2006-10-23 Thread ROB . DIXON
[EMAIL PROTECTED] writes: >> It showed that there is a bug. I already reported it. > > And I already replied ENOTABUG as promised ;-) It's clear what the language should be doing in this situation and it isn't doing it, so it's broken. It's only not a bug in the sense that it's documented to