Re: combinations

2008-10-06 Thread Ryan
While I agree that it would be a good homework assignment it's not. What I have is a logic look up table for health records using an EAV model (in an SQL table): rowID - key - value From a web form I select some keys and values. When submitted, I create a new rowID and put in the

Re: How to check empty hash value properly?

2008-10-06 Thread Jeff Pang
from perldoc -f exists: Given an expression that specifies a hash element or array element, returns true if the specified element in the hash or array has ever been initialized, even if the corresponding value is undefined. The element is not autovivified if it doesn't exist. for details se

Re: How to check empty hash value properly?

2008-10-06 Thread loody
> if( exists $data{$key} ){ >print "\t\$data{$key} exists\n"; Hi: thanks for your kind help. Could I get the conclusion that exists is only used for determining the element of hash and arrays? appreciate your help, miloody -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands,

Re: certification for perl

2008-10-06 Thread Raymond Wan
Peter Scott wrote: On Mon, 06 Oct 2008 09:05:37 -0700, (Randal L. Schwartz) wrote: "Praveena" == Praveena Vittal <[EMAIL PROTECTED]> writes: Praveena> Do you have any idea that these books are available online? Many of them, Only illegally. Don't be a pirate. Don't steal f

Re: certification for perl

2008-10-06 Thread Peter Scott
On Mon, 06 Oct 2008 09:05:37 -0700, (Randal L. Schwartz) wrote: >> "Praveena" == Praveena Vittal <[EMAIL PROTECTED]> writes: > > Praveena> Do you have any idea that these books are available online? > > Many of them, Only illegally. Don't be a pirate. Don't steal from me. Now, now. Many o

RE: combinations

2008-10-06 Thread Jason Trebilcock
-Original Message- From: Rob Dixon [mailto:[EMAIL PROTECTED] Sent: Monday, October 06, 2008 12:37 PM To: Perl Beginners Cc: Randal L. Schwartz; Mr. Shawn H. Corey Subject: Re: combinations What are the real-world problems that are solved using a list of combinations of sets of items? Ro

Re: combinations

2008-10-06 Thread Randal L. Schwartz
> "Rob" == Rob Dixon <[EMAIL PROTECTED]> writes: Rob> The homework aroma entices me to respond with another question - Rob> hopefully an educational one. I hadn't thought of watermarking them Rob> though - good idea :) I didn't come up with the watermark idea. Can't remember where I saw it..

Re: Question about 2's complement

2008-10-06 Thread Rob Dixon
loody wrote: > > I have to compare 2 values which is represented by 2 bytes as 0x > and 0x00fe in 2's complement system. > so the difference between them should be -1 - 254 =-255. > but before do such calculation, I have to translate 0x as -1. > Is there build-in function in perl for me to

Re: Regexp: Correct braces

2008-10-06 Thread Rob Dixon
Mr. Shawn H. Corey wrote: > Rob Dixon wrote: >> >> My example wasn't a nested one. It was just an example of two incorrect brace >> matches as the OP described them. > > You make it sound like I just discovered them and haven't been using > them for the past 30 years. If you have been using state

Re: How to check empty hash value properly?

2008-10-06 Thread John W. Krahn
loody wrote: Dear all: Hello, I want to use hash to keep my records. But before using it, I want to determine whether the value of the key exist? perldoc -q "What.s the difference between .delete. and .undef. with hashes" John -- Perl isn't a toolbox, but a small machine shop where you ca

Re: Question about 2's complement

2008-10-06 Thread John W. Krahn
loody wrote: Dear all: Hello, I have to compare 2 values which is represented by 2 bytes as 0x and 0x00fe in 2's complement system. so the difference between them should be -1 - 254 =-255. but before do such calculation, I have to translate 0x as -1. Is there build-in function in perl

Re: Regexp: Correct braces

2008-10-06 Thread Mr. Shawn H. Corey
On Mon, 2008-10-06 at 12:12 +0100, Rob Dixon wrote: > Mr. Shawn H. Corey wrote: > > On Fri, 2008-10-03 at 12:38 +0100, Rob Dixon wrote: > >> Mr. Shawn H. Corey wrote: > >>> > >>> Note that if these structures can be nested, you will have to use a FSA > >>> with a push-down stack. > >> > >> That wil

Re: combinations

2008-10-06 Thread Rob Dixon
Randal L. Schwartz wrote: >> "Peter" == Peter Scott <[EMAIL PROTECTED]> writes: > > Peter> Did you see the smiley? Randal might have been more inclined to give a > Peter> less cute answer if the poster said what he wanted this for, because it > Peter> does sound like homework. > > Precisely.

Re: combinations

2008-10-06 Thread Rob Dixon
Mr. Shawn H. Corey wrote: > On Mon, 2008-10-06 at 09:02 -0700, Randal L. Schwartz wrote: >> >> As in, my answer started with a joke. Hence the smiley. But I did have a >> puzzling question about this recurring need for "all combinations" and >> always stated rather abstractly, without the real-wo

Re: SSH equivalent to Net::Telnet::Cisco?

2008-10-06 Thread Rodrick Brown
Have you tried the standard Net::SSH does it not work with cisco devices? On Mon, Oct 6, 2008 at 1:22 PM, Paul <[EMAIL PROTECTED]> wrote: > I've searched CPAN, but have not found an equivalent module such as > Net::Telnet::Cisco for SSH (SSH2). Is there one somewhere out there? > Thanks. > > > >

Re: combinations

2008-10-06 Thread Rob Dixon
Randal L. Schwartz wrote: >> ""Mr" == "Mr Shawn H Corey" <[EMAIL PROTECTED]> writes: > > "Mr> On Sun, 2008-10-05 at 21:30 -0700, Randal L. Schwartz wrote: >>> Eh? My question has *nothing* to do with my solution. My question >>> has to do with the original question. > > "Mr> And my question

Re: how can i untain $ARGV from a perl script extending snmp?

2008-10-06 Thread Dr.Ruud
Jordi Moles Blanco schreef: > my $path = $ARGV[3]; my ($path) = $ARGV[3] =~ m{ ^# SOB (# start capturing (?:# start group / # a slash [a-z]+ # followed by 1 or more lowercase letters )

Re: help with regexp

2008-10-06 Thread Rob Dixon
Vyacheslav Karamov wrote: > Hi All! > > I need to capture cite numbers, but I have an extra values. I need to > capture cites, not figures, chapters and so on. > For example in "[see 9; Figure 7]", only "9" i.e. citation number must > be captured. > > > my $regex = qr > { > (

SSH equivalent to Net::Telnet::Cisco?

2008-10-06 Thread Paul
I've searched CPAN, but have not found an equivalent module such as Net::Telnet::Cisco for SSH (SSH2). Is there one somewhere out there? Thanks. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: help with regexp

2008-10-06 Thread Dr.Ruud
Vyacheslav Karamov schreef: > 6 - wrong. I don't understand why 6 instead of 60 was captured. Change your "[1-9]+" to "[1-9][0-9]*". -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: Cache::FastMmap

2008-10-06 Thread Dr.Ruud
[EMAIL PROTECTED] schreef: > i keep on getting this error in httpd log when i run a perl script > which uses cache::fastmmap Does it actually use cache::fastmmap, or Cache::FastMmap? -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands,

Re: combinations

2008-10-06 Thread Mr. Shawn H. Corey
On Mon, 2008-10-06 at 09:02 -0700, Randal L. Schwartz wrote: > As in, my answer started with a joke. Hence the smiley. But I did > have a > puzzling question about this recurring need for "all combinations" and > always > stated rather abstractly, without the real-world need backing it up. > Yo

Re: certification for perl

2008-10-06 Thread Randal L. Schwartz
> "Praveena" == Praveena Vittal <[EMAIL PROTECTED]> writes: Praveena> Do you have any idea that these books are available online? Many of them, Only illegally. Don't be a pirate. Don't steal from me. I'm here to try to help you, but if you steal from me, what's my motivation? -- Randal L

Re: combinations

2008-10-06 Thread Randal L. Schwartz
> "Peter" == Peter Scott <[EMAIL PROTECTED]> writes: Peter> Did you see the smiley? Randal might have been more inclined to give a Peter> less cute answer if the poster said what he wanted this for, because it Peter> does sound like homework. Precisely. If it smells like homework to me, I t

Re: combinations

2008-10-06 Thread Randal L. Schwartz
> ""Mr" == "Mr Shawn H Corey" <[EMAIL PROTECTED]> writes: "Mr> On Sun, 2008-10-05 at 21:30 -0700, Randal L. Schwartz wrote: >> Eh? My question has *nothing* to do with my solution. My question >> has to do with the original question. "Mr> And my question is why isn't these abilities of glob

RE: certification for perl

2008-10-06 Thread Stewart Anderson
> From: Jeff Pang [mailto:[EMAIL PROTECTED] > Sent: 06 October 2008 14:37 > To: Praveena Vittal > Cc: beginners@perl.org > Subject: Re: certification for perl > > > Message du 06/10/08 15:31 > > De : "Praveena Vittal" > > A : "Jeff Pang" > > Copie à : beginners@perl.org > > Objet : Re: certificati

Re: LWP / HTTP content

2008-10-06 Thread Dermot
2008/10/6 Dermot <[EMAIL PROTECTED]>: > Hi, > > use HTTP::Request::Common qw(POST); > > my $req = POST $url, [user => '[EMAIL PROTECTED]', passwd => > 'B3NzaC1yo7393Cbonx2a1xd562LiCjtYwU7LAb' , contrib => $code]; > That was wrong of me. I should have tested more before I hit send. Of course

LWP / HTTP content

2008-10-06 Thread Dermot
Hi, I am trying to configure a POST request using LWP to post the hash below. my %test = ( user=> '[EMAIL PROTECTED]', passwd => 'B3NzaC1yo7393Cbonx2a1xd562LiCjtYwU7LAb', contrib => $code, name => $name, id

help with regexp

2008-10-06 Thread Vyacheslav Karamov
Hi All! I need to capture cite numbers, but I have an extra values. I need to capture cites, not figures, chapters and so on. For example in "[see 9; Figure 7]", only "9" i.e. citation number must be captured. my $regex = qr { (?i)

Re: data from file

2008-10-06 Thread Mr. Shawn H. Corey
On Mon, 2008-10-06 at 07:11 -0700, [EMAIL PROTECTED] wrote: > Hi, > > I have large file in following format: > > ID | Time | IP | Code > > > Now I want to write script that will cluster data by IP addr. and > count total number of IDs for corresponding IP. > > I am new to perl. > > #!/usr/b

Re:data from file

2008-10-06 Thread Jeff Pang
> Message du 06/10/08 17:03 > De : "[EMAIL PROTECTED]" > A : beginners@perl.org > Copie à : > Objet : data from file > > > Hi, > > I have large file in following format: > > ID | Time | IP | Code > > > Now I want to write script that will cluster data by IP addr. and > count total number of IDs for

data from file

2008-10-06 Thread [EMAIL PROTECTED]
Hi, I have large file in following format: ID | Time | IP | Code Now I want to write script that will cluster data by IP addr. and count total number of IDs for corresponding IP. I am new to perl. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED

Re: how can i untain $ARGV from a perl script extending snmp? [solved]

2008-10-06 Thread Jordi Moles Blanco
En/na Raymond Wan ha escrit: Hi Jordi, Jordi Moles Blanco wrote: 1. how can i "untain" that var? 2. can i modify the way that snmp works to disable that "-T" flag when it passes the control to the perl script? i've tried to untain the var with any means i've found, like this one: ***

Re: How to check empty hash value properly?

2008-10-06 Thread Mr. Shawn H. Corey
On Mon, 2008-10-06 at 22:35 +0900, Raymond Wan wrote: > Try: > > if (defined $hash{$key}) { > ... > Defined is not the same as exists. #!/usr/bin/perl use strict; use warnings; my %data = ( b => undef, c => 1, ); for my $key ( qw( a b c ) ){ print "\$key = $key\n"; if( exists $data{$

Re: combinations

2008-10-06 Thread Peter Scott
On Sun, 05 Oct 2008 19:06:35 -0400, Mr. Shawn H. Corey wrote: > On Sun, 2008-10-05 at 15:11 -0700, Randal L. Schwartz wrote: >> my @result = map [split /-/], glob "{a}-{b,c}-{d,e,f}-{a}"; >> >> :-) >> >> But seriously, why does this come up often? > > Because your solution relies on knowledge of

Re: certification for perl

2008-10-06 Thread Praveena Vittal
Jeff, So many new books i heard. Do you have any idea that these books are available online? Thanks, Praveena Jeff Pang wrote: Who asked you for that? Ok you say you have read all the books below, that will be enough for a certification. :-) Advanced Perl Programming - O'Reilly 1999.p

Re:Cache::FastMmap

2008-10-06 Thread Jeff Pang
> Message du 06/10/08 15:40 > De : "[EMAIL PROTECTED]" > A : beginners@perl.org > Copie à : > Objet : Cache::FastMmap > > > Cache::FastMmap does not support threads sorry at /usr/lib/perl5/ > site_perl/5.8.5/i386-linux-thread-multi/Cache/FastMmap.pm line 1134 > You should re-install Perl and

Cache::FastMmap

2008-10-06 Thread [EMAIL PROTECTED]
Cache::FastMmap does not support threads sorry at /usr/lib/perl5/ site_perl/5.8.5/i386-linux-thread-multi/Cache/FastMmap.pm line 1134 hi all, i keep on getting this error in httpd log when i run a perl script which uses cache::fastmmap how can i rectify this and run script successfully i checke

Re: certification for perl

2008-10-06 Thread Jeff Pang
> Message du 06/10/08 15:31 > De : "Praveena Vittal" > A : "Jeff Pang" > Copie à : beginners@perl.org > Objet : Re: certification for perl > > Jeff, > > So many new books i heard. > > Do you have any idea that these books are available online? > I don't know if they all are free o

Re: How to check empty hash value properly?

2008-10-06 Thread Raymond Wan
Hi Miloody, Try: if (defined $hash{$key}) { ... Ray loody wrote: Dear all: I want to use hash to keep my records. But before using it, I want to determine whether the value of the key exist? Below is my source code: if($hash{$key} eq "") { print "the value of the $key is empty\n";

Re:How to check empty hash value properly?

2008-10-06 Thread Jeff Pang
> Message du 06/10/08 15:25 > De : "loody" > A : "Perl beginners" > Copie à : > Objet : How to check empty hash value properly? > > > Dear all: > I want to use hash to keep my records. > But before using it, I want to determine whether the value of the key exist? > Below is my source code: > if($ha

Re: Question about 2's complement

2008-10-06 Thread Mr. Shawn H. Corey
On Mon, 2008-10-06 at 21:18 +0800, loody wrote: > Dear all: > I have to compare 2 values which is represented by 2 bytes as 0x > and 0x00fe in 2's complement system. > so the difference between them should be -1 - 254 =-255. > but before do such calculation, I have to translate 0x as -1. >

Re:certification for perl

2008-10-06 Thread Jeff Pang
Who asked you for that? Ok you say you have read all the books below, that will be enough for a certification. :-) Advanced Perl Programming - O'Reilly 1999.pdf Advanced Perl Programming, 2nd Edition (2005).chm Automating Windows with Perl - Miller Freeman 1999.pdf Beginning Perl - Wrox 2000.pdf

How to check empty hash value properly?

2008-10-06 Thread loody
Dear all: I want to use hash to keep my records. But before using it, I want to determine whether the value of the key exist? Below is my source code: if($hash{$key} eq "") { print "the value of the $key is empty\n"; $hash{$key}=1; } else { $hash{$key}++; } It works but I wi

Question about 2's complement

2008-10-06 Thread loody
Dear all: I have to compare 2 values which is represented by 2 bytes as 0x and 0x00fe in 2's complement system. so the difference between them should be -1 - 254 =-255. but before do such calculation, I have to translate 0x as -1. Is there build-in function in perl for me to use, or should

RE: certification for perl

2008-10-06 Thread Bob McConnell
From: Rob Coops On Mon, Oct 6, 2008 at 2:16 PM, Praveena Vittal <[EMAIL PROTECTED]>wrote: > > I like to do some certification in perl,but i could not get any information > > about the available certifications in perl . > > > > Could anyone help me in this? > > > > Oh, boy that is a can of worms

Re: how can i untain $ARGV from a perl script extending snmp?

2008-10-06 Thread Raymond Wan
Hi Jordi, Jordi Moles Blanco wrote: 1. how can i "untain" that var? 2. can i modify the way that snmp works to disable that "-T" flag when it passes the control to the perl script? i've tried to untain the var with any means i've found, like this one: * $path =~ s/;//g; *

Re: Regular expression question

2008-10-06 Thread Mr. Shawn H. Corey
On Mon, 2008-10-06 at 04:51 -0700, irata wrote: > perl -e '$text = "(7) 32"; printf "[%s][%s]\n", ( $text =~ /\((\d+) > \)\s+(\d+)/ )' $ perl -e '$text = "(7) 32"; printf "[%s][%s]\n", ( $text =~ /\((\d+) > \)\s+(\d+)/ )' [][] $ perl -e '$text = "(7) 32"; printf "[%s][%s]\n", ( $text =~

Re: Regular expression question

2008-10-06 Thread Olteanu Eugen
It looks there is a space there.. # perl -e '$text = "(7) 32"; printf "[%s][%s]\n", ( $text =~ /\((\d+) \)\s+(\d+)/ )' [][] # perl -e '$text = "(7) 32"; printf "[%s][%s]\n", ( $text =~ /\((\d+)\)\s+(\d+)/ )' [7][32] On Mon, Oct 6, 2008 at 2:51 PM, irata <[EMAIL PROTECTED]> wrote: > Hello,

Regular expression question

2008-10-06 Thread irata
Hello, can someone explain me, why this short regex don't give the result I expect: perl -e '$text = "(7)   32"; printf "[%s][%s]\n", ( $text =~ /\((\d+) \)\s+(\d+)/ )' I supposed that the output is "[7][32]", but the output is "[][]". I don't know why... Regards... -- To unsubscribe, e-mail

Re: certification for perl

2008-10-06 Thread Rob Coops
On Mon, Oct 6, 2008 at 2:16 PM, Praveena Vittal <[EMAIL PROTECTED]>wrote: > Hi All, > > I like to do some certification in perl,but i could not get any information > about the available certifications in perl . > > Could anyone help me in this? > > Thanks, > Praveena > Oh, boy that is a can of w

certification for perl

2008-10-06 Thread Praveena Vittal
Hi All, I like to do some certification in perl,but i could not get any information about the available certifications in perl . Could anyone help me in this? Thanks, Praveena

how can i untain $ARGV from a perl script extending snmp?

2008-10-06 Thread Jordi Moles Blanco
hi, I'm really struggling with this and i would very pleased if you could help me. I'm using a perl script to extend snmp functionality. As you already now, when snmp "passes" the control to the perl script, it enables the flag "-T" . Therefore, the problem is that i can't use any tainted v

Re: Tie::FILE vs open

2008-10-06 Thread Jenda Krynicky
From: org chen <[EMAIL PROTECTED]> > I have a huge file, there are 47,286,116 lines. I am search a line and > repalce this line with another string. I know this line is between > 20,000,000th to 30,000,000th lines. Which way is more fast and safe: And is the string exactly as long as the original

Re: Regexp: Correct braces

2008-10-06 Thread Rob Dixon
Mr. Shawn H. Corey wrote: > On Fri, 2008-10-03 at 12:38 +0100, Rob Dixon wrote: >> Mr. Shawn H. Corey wrote: >>> >>> Note that if these structures can be nested, you will have to use a FSA >>> with a push-down stack. >> >> That will match a line like >> >> [wrong) and (wrong] >> >> Rob >> > > No

Re: combinations

2008-10-06 Thread Rob Dixon
Mr. Shawn H. Corey wrote: > On Sun, 2008-10-05 at 21:30 -0700, Randal L. Schwartz wrote: >> >> Eh? My question has *nothing* to do with my solution. My question >> has to do with the original question. > > And my question is why isn't these abilities of glob described in > perldoc? They are des

Re: combinations

2008-10-06 Thread Mr. Shawn H. Corey
On Sun, 2008-10-05 at 21:30 -0700, Randal L. Schwartz wrote: > Eh? My question has *nothing* to do with my solution. My question > has to do with the original question. And my question is why isn't these abilities of glob described in perldoc? -- Just my 0.0002 million dollars worth, Sh