generating arrays on the fly

2002-08-27 Thread afarrell
hi, what I'm wanting to do is generate an array named after a string that is found in a text file. i.e something like this: if ($line=~(/^\[\[(\w+)\]\]/)){ @$1=(); #this is the line I want to acheive my aim with! } I know the syntax is wrong, but hopefully it explains what I'm trying to do, a

Re: generating arrays on the fly

2002-08-27 Thread Ramprasad A Padmanabhan
[EMAIL PROTECTED] wrote: > hi, > > what I'm wanting to do is generate an array named after a string that is > found in a text file. > > i.e something like this: > if ($line=~(/^\[\[(\w+)\]\]/)){ > @$1=(); #this is the line I want to acheive my aim with! > } > > I know the syntax is wrong, but

RE: generating arrays on the fly

2002-08-27 Thread Nikola Janceski
ROTECTED]] > Sent: Tuesday, August 27, 2002 9:57 AM > To: [EMAIL PROTECTED] > Subject: generating arrays on the fly > > > hi, > > what I'm wanting to do is generate an array named after a > string that is > found in a text file. > > i.e something like this

RE: generating arrays on the fly

2002-08-27 Thread Bob Showalter
> -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, August 27, 2002 9:57 AM > To: [EMAIL PROTECTED] > Subject: generating arrays on the fly > > > hi, > > what I'm wanting to do is generate an array named after a

Re: generating arrays on the fly

2002-08-27 Thread Jeff 'japhy' Pinyan
On Aug 27, Ramprasad A Padmanabhan said: >> if ($line=~(/^\[\[(\w+)\]\]/)){ >> @$1=(); #this is the line I want to acheive my aim with! >> } > > if ($line=~(/^\[\[(\w+)\]\]/)){ > eval('@' .$1 .' = () ') || warn $@ > } First, don't do that. You're doing symbolic references in effect. Second

Re: generating arrays on the fly

2002-08-27 Thread Ramprasad A Padmanabhan
Thanx I am not a great master of perl , but have been getting my job done with perl for the past 2 years. Can u educate me why I cant do 'symbolic references' in eval('@' .$1 .' = () ') On Wed, 2002-08-28 at 03:31, Jeff 'japhy' Pinyan wrote: > On Aug 27, Ramprasad A Padmanabhan said: > > >> i

Re: generating arrays on the fly

2002-08-27 Thread Sudarshan Raghavan
On 28 Aug 2002, Ramprasad A Padmanabhan wrote: > Thanx > I am not a great master of perl , but have been getting my job done > with perl for the past 2 years. Can u educate me why I cant do 'symbolic > references' in eval('@' .$1 .' = () ') This does not just apply for eval, symbolic reference

RE: generating arrays on the fly

2002-08-27 Thread Dharmendra Rai
Hi , The name of the global var is put into symtab during compilation while that of local var is converted to its offset. So if u want to "NAME" a var at run-time, u won't succeed. All u can do is that use hash-table with the KEYNAMES as those words appearing in the file. Read about the th

RE: generating arrays on the fly

2002-08-28 Thread Bob Showalter
> -Original Message- > From: Ramprasad A Padmanabhan [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, August 28, 2002 1:27 AM > To: [EMAIL PROTECTED] > Cc: Ramprasad A Padmanabhan; [EMAIL PROTECTED] > Subject: Re: generating arrays on the fly > > > Thanx > I