slurp hash from file

2007-02-27 Thread Jorge Almeida
I want to define a hash reference like this: my $h={ a = 'a', b = 'aa \ bbb', }; (Note the string containing escaped newlines.) Now, the point is that I have the block a = 'a', b = 'aa \ bbb', in a text file. It

Re: slurp hash from file

2007-02-27 Thread Adriano Ferreira
On 2/27/07, Jorge Almeida [EMAIL PROTECTED] wrote: I want to define a hash reference like this: my $h={ a = 'a', b = 'aa \ bbb', }; (Note the string containing escaped newlines.) Now, the point is that I have the block a = 'a',

Re: slurp hash from file

2007-02-27 Thread Jorge Almeida
On Tue, 27 Feb 2007, Adriano Ferreira wrote: On 2/27/07, Jorge Almeida [EMAIL PROTECTED] wrote: Let's say your data is in the file data.pl. Then my %hash = do data.pl; my $hash_ref = \%hash; Great! Thanks. -- Jorge Almeida -- To unsubscribe, e-mail: [EMAIL PROTECTED] For

RE: Inefficient code?

2007-02-27 Thread Johnson, Reginald \(GTI\)
-Original Message- From: John W. Krahn [mailto:[EMAIL PROTECTED] Sent: Sunday, February 18, 2007 4:15 PM To: Perl Beginners Subject: Re: Inefficient code? Johnson, Reginald (GTI) wrote: My code is comparing the variables node and db in one input file to bkup_node and bkup_db in the

how good is 'crypt()'?

2007-02-27 Thread tom arnall
how good is 'crypt()'? it seems that for small differences in the target string you get duplicate digests. i get the following results (using debugger): DB1 $f='aaab' DB2 $g='aaac' DB3 p crypt($f,'ab')

Re: how good is 'crypt()'?

2007-02-27 Thread Tom Phoenix
On 2/27/07, tom arnall [EMAIL PROTECTED] wrote: how good is 'crypt()'? it seems that for small differences in the target string you get duplicate digests. That's not what it's good at. Are you trying to use it for checksumming or encryption, or something else it wasn't designed to do? i get

help with array within another array

2007-02-27 Thread Ravi Malghan
Hi: I just can't seem to figure this out. I am trying to declare two associative array (%nodeowner and %nodeseverity) within another array called %SESSION For example %nodeowner = (node1, john, node2, nancy); %nodeseverity = (node1, 5, node2, 10); How do I declare %SESSION containing %nodeowner

Re: how good is 'crypt()'?

2007-02-27 Thread Chas Owens
On 2/27/07, tom arnall [EMAIL PROTECTED] wrote: how good is 'crypt()'? it seems that for small differences in the target string you get duplicate digests. i get the following results (using debugger): snip Better than rot13, but worse than most other forms of encryption. The crypt function is

Re: help with array within another array

2007-02-27 Thread Ravi Malghan
One correction: SESSION is just a single dimensional array @SESSION. Thanks Ravi --- Ravi Malghan [EMAIL PROTECTED] wrote: Hi: I just can't seem to figure this out. I am trying to declare two associative array (%nodeowner and %nodeseverity) within another array called %SESSION For example

Re: help with array within another array

2007-02-27 Thread Neal Clark
well first of all you're using the syntax for non-associative arrays (normal @arrays). your hash declarations should look like this: %nodeowner = (node1 = john, node2 = nancy); %nodeseverity = (node1 = 5, node2 = 10); as for %SESSION, you could make a hash with reference to hash values:

Re: help with array within another array

2007-02-27 Thread Neal Clark
ah. well in that case @SESSION = ( \%nodeowner, \%nodeseverity ); On Feb 27, 2007, at 11:59 AM, Ravi Malghan wrote: One correction: SESSION is just a single dimensional array @SESSION. Thanks Ravi --- Ravi Malghan [EMAIL PROTECTED] wrote: Hi: I just can't seem to figure this out. I am

Re: Inefficient code?

2007-02-27 Thread John W. Krahn
Johnson, Reginald (GTI) wrote: From: John W. Krahn [mailto:[EMAIL PROTECTED] Johnson, Reginald (GTI) wrote: foreach $bkline (@bkupArray) { my ($bkup_node_ora,$bkup_db,$bk_blank,$id,$type,$cap,$start,$filler,$filler2,$filler3,$filler4,$bk_end,$rest)=

Re: help with array within another array

2007-02-27 Thread John W. Krahn
Ravi Malghan wrote: Hi: I just can't seem to figure this out. I am trying to declare two associative array (%nodeowner and %nodeseverity) within another array called %SESSION For example %nodeowner = (node1, john, node2, nancy); %nodeseverity = (node1, 5, node2, 10); How do I declare

Re: help with array within another array

2007-02-27 Thread Ravi Malghan
what am I doing wrong here when trying to access the value john for node1 = $SESSION{FirstRun} = 1; %nodeowner = (node1, john, node2, nancy); push(@SESSION, %nodeowner); print node1: $SESSION{$nodeowner{node1}}\n; == Thanks Ravi --- Neal Clark [EMAIL PROTECTED] wrote: ah. well

Re: help with array within another array

2007-02-27 Thread Chas Owens
On 2/27/07, Ravi Malghan [EMAIL PROTECTED] wrote: Hi: I just can't seem to figure this out. I am trying to declare two associative array Just call them hashes, everybody else does. (%nodeowner and %nodeseverity) within another array called %SESSION For example %nodeowner = (node1, john,

Re: help with array within another array

2007-02-27 Thread Neal Clark
you are working with two different variables. On Feb 27, 2007, at 12:24 PM, Ravi Malghan wrote: what am I doing wrong here when trying to access the value john for node1 = $SESSION{FirstRun} = 1; this line creates a _hash_, %SESSION with one element (keyed by FirstRun, value is 1).

Re: help with array within another array

2007-02-27 Thread Chas Owens
On 2/27/07, Ravi Malghan [EMAIL PROTECTED] wrote: what am I doing wrong here when trying to access the value john for node1 = $SESSION{FirstRun} = 1; %nodeowner = (node1, john, node2, nancy); push(@SESSION, %nodeowner); print node1: $SESSION{$nodeowner{node1}}\n; snip Off that bat I

Re: help with array within another array

2007-02-27 Thread Chas Owens
On 2/27/07, Neal Clark [EMAIL PROTECTED] wrote: snip sorry about saying you had the wrong syntax earlier, i thought it was. i never knew you could do hashes with the comma operator. neat. i don't think its very clear syntactically but if it works it works :-) snip In Perl 5 the only difference

Re: help with array within another array

2007-02-27 Thread John W. Krahn
Neal Clark wrote: you are working with two different variables. On Feb 27, 2007, at 12:24 PM, Ravi Malghan wrote: what am I doing wrong here when trying to access the value john for node1 = $SESSION{FirstRun} = 1; this line creates a _hash_, %SESSION with one element (keyed by

Re: help with array within another array

2007-02-27 Thread John W. Krahn
Chas Owens wrote: On 2/27/07, Neal Clark [EMAIL PROTECTED] wrote: snip sorry about saying you had the wrong syntax earlier, i thought it was. i never knew you could do hashes with the comma operator. neat. i don't think its very clear syntactically but if it works it works :-) snip In

cgi calender

2007-02-27 Thread oryann9
All, I am having an issue getting my cgi calender to print correctly. Any help or hints would be appreciated! I was thinking of manipulating the @weeks_anonymous array with select dayofweek(curdate()) rather than using hardcoed undef's Problem: cgi calender daynames are not matching up with

Re: cgi calender

2007-02-27 Thread oryann9
--- oryann9 [EMAIL PROTECTED] wrote: All, I am having an issue getting my cgi calender to print correctly. Any help or hints would be appreciated! I was thinking of manipulating the @weeks_anonymous array with select dayofweek(curdate()) rather than using hardcoed undef's Problem: