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

2007-08-29 Thread Justin The Cynical
Ok, I think I more or less have it. The true grocking of the hash, well, that I think will come in time with reading and experience. Thank you all for the help and pointers! Justin -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.per

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: 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: 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: Trying to dynamically create arrays, getting can't use string as ARRAY ref

2007-08-24 Thread Randal L. Schwartz
> "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 single value, so we haven't really lied, so much as just simplified to what c

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

2007-08-24 Thread Jeff Pang
2007/8/24, Justin The Cynical <[EMAIL PROTECTED]>: > On Aug 23, 2:00 am, [EMAIL PROTECTED] (Lists User) wrote: > > *snip* > > > my %grouplist; > > open HD,'groups.txt' or die $!; > > > > while() { > > chomp; > > my @tmp = split; > > my $groupname = shift @tmp; > > $grouplist{$groupn

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

2007-08-24 Thread Justin The Cynical
On Aug 23, 3:42 am, [EMAIL PROTECTED] (Paul Lalli) wrote: > On Aug 23, 2:00 am, [EMAIL PROTECTED] (Justin The Cynical) wrote: *snip* > > Can't use string ("prod01") as an ARRAY ref while "strict refs" in use > > perldoc -q "variable name" Ah, OK, thanks. I've got a bit of reading to do. :-) >

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

2007-08-24 Thread Justin The Cynical
On Aug 23, 2:00 am, [EMAIL PROTECTED] (Lists User) wrote: *snip* > my %grouplist; > open HD,'groups.txt' or die $!; > > while() { > chomp; > my @tmp = split; > my $groupname = shift @tmp; > $grouplist{$groupname} = [EMAIL PROTECTED];} > > close HD; OK, thanks! The Llama presents

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

2007-08-23 Thread Paul Lalli
On Aug 23, 2:00 am, [EMAIL PROTECTED] (Justin The Cynical) wrote: > Add the name of the array to a 'master array' list of the machine > groups > Then create another array, which would be referenced by the group > name, and contains the machines associated with the group. > The script runs if I do

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

2007-08-23 Thread lists user
Hi, Rather than a dynamic array,you just need to use a correct datastru,a hash. It's maybe better to write codes as below. [tmp]$ cat groups.txt prod01 456 345 234 prod02 789 517 325 prod03 789 517 325 prod04 789 517 325 prod05 789 517 325 [tmp]$ cat test.pl #!/usr/bin/perl use strict; use warni

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

2007-08-23 Thread Justin The Cynical
Greets. I have a 'config file' that contains a group name (alphanumeric) and machine name/numbers separated by whitespace. Each group is on it's own line. The file looks like this: prod01 456 345 234 prod02 789 517 325 ...etc, etc, etc... What I am attempting to do is: Put the file contents in