Re: store more values in a hash array

2007-08-26 Thread Jeff Pang
Hello, You need an array of hash to do it.That's to say,to store array's reference (or anonymous array) as hash's values. my %hash = (key1 => [EMAIL PROTECTED], key2 =>. [EMAIL PROTECTED] ...); or, my %hash = (key1 => [a,b,c], key2 => [1,2,3] ...); 2007/8/27, Andreas Moroder <[EMAIL PROTECTED

store more values in a hash array

2007-08-26 Thread Andreas Moroder
Hello, I have to store more then one value in a hash array. I tried to store a array as value in the hash. But when I try to retriev it I don't get the array I have stroed. Can anyone please help me. Thanks Andreas -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mai

Re: Longest prefix match

2007-08-26 Thread Gunnar Hjalmarsson
Mihir Kamdar wrote: I want to implement longest prefix match in my code in perl, but am not able to get started with it. I am sure, it can be easily achieved with the help of regex in perl, but I haven't worked on it. perldoc perlrequick perldoc perlretut perldoc perlre Good luck!

Re: Longest prefix match

2007-08-26 Thread Jeff Pang
first build a hash which record all countries and their codes. my %countries = (852 => 'Hong Kong', 853 => 'Macau' ...); then use regex or other ways (I prefer substr) to get the prefix. my $prefix = substr($string,1,3); last get the country name via the prefix code. my $country = $countries{$pre

Re: Longest prefix match

2007-08-26 Thread Chas Owens
On 8/27/07, Mihir Kamdar <[EMAIL PROTECTED]> wrote: > Hi, > > I want to implement longest prefix match in my code in perl, but am not able > to get started with it. I am sure, it can be easily achieved with the help > of regex in perl, but I haven't worked on it. Following is what I want to > do:-

Longest prefix match

2007-08-26 Thread Mihir Kamdar
Hi, I want to implement longest prefix match in my code in perl, but am not able to get started with it. I am sure, it can be easily achieved with the help of regex in perl, but I haven't worked on it. Following is what I want to do:- If the phone number is +852 ---> The country is Hong Kong

Re: Redirecting to another url with parameters using post method

2007-08-26 Thread Gunnar Hjalmarsson
yitzle wrote: On 8/26/07, Gunnar Hjalmarsson <[EMAIL PROTECTED]> wrote: Btw, is this technique properly documented anywhere, or would it be a suitable addition to perlfaq9? Its not a Perl technique. Its part of the HTTP specs. NAME perlfaq9 - Networking ($Revision: 1.15 $, $Date: 2003/01/31

Re: a division warning

2007-08-26 Thread Chas Owens
On 8/26/07, lists user <[EMAIL PROTECTED]> wrote: > I run a perl command below, > > perl -Mstrict -Mwarnings -e 'eval {my $x=3;my $y=$x-3;$x/$y};print "hello"' > Useless use of division (/) in void context at -e line 1. > hello > > I'm confused about the first warning.What's it?thanks. Let's break

a division warning

2007-08-26 Thread lists user
I run a perl command below, perl -Mstrict -Mwarnings -e 'eval {my $x=3;my $y=$x-3;$x/$y};print "hello"' Useless use of division (/) in void context at -e line 1. hello I'm confused about the first warning.What's it?thanks. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-

Re: subroutine references

2007-08-26 Thread Chas Owens
On 8/26/07, Mr. Shawn H. Corey <[EMAIL PROTECTED]> wrote: > Dr.Ruud wrote: > >> Why do people who write these books have exercises of little > >> practical value? > > > > An exercise needs to be educational. > > I have worked in programming for 25 years and during that time I have never > use a >

Re: Redirecting to another url with parameters using post method

2007-08-26 Thread yitzle
On 8/26/07, Gunnar Hjalmarsson <[EMAIL PROTECTED]> wrote: > Mumia W. wrote: snip > Btw, is this technique properly documented anywhere, or would it be a > suitable addition to perlfaq9? Its not a Perl technique. Its part of the HTTP specs. PS Why do my emails show up on the www.codecomments.com f

Re: building Perl 5.8.8

2007-08-26 Thread brian d foy
In article <[EMAIL PROTECTED]>, Robert Hicks <[EMAIL PROTECTED]> wrote: > When it asks about threads should I enable them or no? In Perl's Configure, if you don't understand the question, accept the default answer. :) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail:

Re: subroutine references

2007-08-26 Thread brian d foy
In article <[EMAIL PROTECTED]>, Mr. Shawn H. Corey <[EMAIL PROTECTED]> wrote: > Chris wrote: > > I'm working on yet another exercise from Intermediate Perl. I've been > > given a script that searches for files that fall between a two > > timestamps. > Why do people who write these books have e

Re: Redirecting to another url with parameters using post method

2007-08-26 Thread Gunnar Hjalmarsson
Mumia W. wrote: Mumia W. wrote: On 08/25/2007 04:32 PM, Gunnar Hjalmarsson wrote: Jeff Pang wrote: 2007/8/25, Praveena Vittal <[EMAIL PROTECTED]>: I want to redirect to a different url with the parameters in the post method. Well,see 'perldoc CGI' and specially check for, param, redirect.

Re: File::Find

2007-08-26 Thread Randal L. Schwartz
> "Somu" == Somu <[EMAIL PROTECTED]> writes: Somu> The code didnt work. Error: Somu> Can't stat /my/dir: No such file or directory Somu> at test.pl line 12 Then you don't have "/my/dir". :) I'd actually be surprised if you did. I haven't seen any systems that have /my as a top-level direc

Re: subroutine references

2007-08-26 Thread Rob Dixon
Mr. Shawn H. Corey wrote: Dr.Ruud wrote: Why do people who write these books have exercises of little practical value? An exercise needs to be educational. I have worked in programming for 25 years and during that time I have never use a closure and have never seen one used. I may be har

Re: File::Find

2007-08-26 Thread Somu
The code didnt work. Error: Can't stat /my/dir: No such file or directory at test.pl line 12 On 8/20/07, Martin Barth <[EMAIL PROTECTED]> wrote: > On Fri, 17 Aug 2007 07:48:33 -0700 > [EMAIL PROTECTED] (Randal L. Schwartz) wrote: > > > Why not just: > > > > my @list; > > find sub { push @list, $$

Re: subroutine references

2007-08-26 Thread Randal L. Schwartz
> "Shawn" == "Mr Shawn H Corey" <[EMAIL PROTECTED]> writes: Shawn> Oh, I get it. When I said 25 years, you thought that I meant 25 years Shawn> with Perl. No. Shawn> Sorry, about the confusion. No confusion. Shawn> I have programmed in many different languages and have never seen a

Re: subroutine references

2007-08-26 Thread Mr. Shawn H. Corey
Randal L. Schwartz wrote: "Shawn" == Shawn H Corey <[EMAIL PROTECTED]> writes: Shawn> Why do you include an insult with every thing you post? I don't think I do. I was only making fun of your claim, since you made the claim. Why did you include "25 years"? It just sets you up for a fall. :)

Re: subroutine references

2007-08-26 Thread Randal L. Schwartz
> "Shawn" == Shawn H Corey <[EMAIL PROTECTED]> writes: Shawn> Why do you include an insult with every thing you post? I don't think I do. I was only making fun of your claim, since you made the claim. Why did you include "25 years"? It just sets you up for a fall. :) Shawn> BTW, what lege

Re: subroutine references

2007-08-26 Thread Mr. Shawn H. Corey
Randal L. Schwartz wrote: Think of closures as "variables that hold behavior". Sure, maybe you've never needed that in your legendary 25 years in the industry, but I've used it *frequently* in my 30 years. :) Why do you include an insult with every thing you post? BTW, what legends do you ha

Re: subroutine references

2007-08-26 Thread Randal L. Schwartz
> ""Mr" == "Mr Shawn H Corey" <[EMAIL PROTECTED]> writes: Mr> Objects can do the same things as closures, which is store and hide data, Mr> but don't have this problem of having to keep in mind two phases of the Mr> same code. But objects have fixed code with variable data. Closures can have

Re: subroutine references

2007-08-26 Thread Mr. Shawn H. Corey
Dr.Ruud wrote: Why do people who write these books have exercises of little practical value? An exercise needs to be educational. I have worked in programming for 25 years and during that time I have never use a closure and have never seen one used. I may be harsh in my definitions but t

Re: Trying to dynamically create arrays, getting can't use string as ARRAY ref

2007-08-26 Thread Peter Scott
On Sun, 26 Aug 2007 12:17:49 -0400, Mr. Shawn H. Corey wrote: > Peter Scott wrote: >> Don't use the term "symlink", however tempting, or you'll confuse >> yourself and others about real symlinks. Yes, it's not an array in the >> hash; it's a scalar containing a *reference* to an array, and there m

Re: Trying to dynamically create arrays, getting can't use string as ARRAY ref

2007-08-26 Thread Mr. Shawn H. Corey
Peter Scott wrote: Don't use the term "symlink", however tempting, or you'll confuse yourself and others about real symlinks. Yes, it's not an array in the hash; it's a scalar containing a *reference* to an array, and there may or may not be other references to that array elsewhere in the progra

Re: Convert int for string

2007-08-26 Thread Xavier Noria
On Aug 26, 2007, at 3:52 PM, Peter Scott wrote: The term "strong typing" is so ill-defined as to make this an angels-dancing-on-a-pinhead discussion and unlikely to lead to any enlightenment. Even the Wikipedia definition says that there *is* no accepted definition and some of the common usages

Re: Trying to dynamically create arrays, getting can't use string as ARRAY ref

2007-08-26 Thread Peter Scott
On Sun, 26 Aug 2007 01:00:31 +, Justin The Cynical wrote: > On Aug 24, 9:11 am, [EMAIL PROTECTED] (Randal L. Schwartz) wrote: >> That's because (a) an arrayref is still a single value, so we haven't really >> lied, so much as just simplified to what can be handled in the first 30 hours >> with

Re: Convert int for string

2007-08-26 Thread Peter Scott
On Sat, 25 Aug 2007 18:22:13 -0700, (Randal L. Schwartz) wrote: >> ""Jeff" == "Jeff Pang" <[EMAIL PROTECTED]> writes: > > "Jeff> Perl isn't a strong type language like C,so you don't have the need to > "Jeff> convert the variable type distinctly. > > Perl is a very strongly typed language. T

Re: Trying to dynamically create arrays, getting can't use string as ARRAY ref

2007-08-26 Thread Justin The Cynical
On Aug 24, 9:11 am, [EMAIL PROTECTED] (Randal L. Schwartz) wrote: > > "Justin" == Justin The Cynical <[EMAIL PROTECTED]> writes: > > Justin> The Llama presents hashes as single value to a key, so I never thought > Justin> to make a hash of arrays. > > That's because (a) an arrayref is still a s

Re: Convert int for string

2007-08-26 Thread Xavier Noria
On Aug 26, 2007, at 3:22 AM, Randal L. Schwartz wrote: Perl is a very strongly typed language. The problem is that people keep thinking "number" or "string" is a type in Perl. It isn't. The type is called "scalar". Other types are "array" and "hash" and "filehandle" and "dirhandle" and