RE: generating arrays on the fly

2002-08-28 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

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 am not a great master of perl

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 hopefully

RE: generating arrays on the fly

2002-08-27 Thread Nikola Janceski
perhaps a hash of arrays is what you want: if ($line=~(/^\[\[(\w+)\]\]/)){ $HASH{$1} = []; } and you reference the array like push @{ $HASH{'text'} }, someinfo; or anyother array functions. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday,

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, that

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: if

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 references