AW: AW: Hash with variable name

2010-05-12 Thread HACKER Nora
Hi, > You put an escape character '\' (no quote) to point to another hash > (what follows / symbol, to be more precise). It's known as > (hash/array/code) references. > > my %stp_dirs = ('mvb' => \%mvb_dirs, > 'pkv' => \%pkv_dirs, > 'av' =>

AW: Hash with variable name

2010-05-12 Thread Thomas Bätzler
HACKER Nora asked: > Thanks for your explanation and the reference to perldoc, I understand > now. But it doesn't work yet, I still get the same error. I have > altered my source now as follows: > > my %stp_dirs = ( "mvb" => "\%mvb_dirs", > "pkv" => "\%pkv_di

Re: AW: Hash with variable name

2010-05-12 Thread Akhthar Parvez K
On Wednesday 12 May 2010, HACKER Nora wrote: > Thanks for your explanation and the reference to perldoc, I understand now. > But it doesn't work yet, I still get the same error. I have altered my source > now as follows: > > my %stp_dirs = ( "mvb" => "\%mvb_dirs", >  

Re: AW: Hash with variable name

2010-05-12 Thread Akhthar Parvez K
Hi Nora, On Wednesday 12 May 2010, HACKER Nora wrote: > > while ( my($sdir,$tdir) = each %{$stp_dirs{'mvb'}}) { > > print("SourceDir: $sdir\t\tTargetDir: $tdir\n"); > > } > > Is that 'mvb' intentional? Also, I don't understand why to put '\%' in front > of the values from the master hash.

AW: Hash with variable name

2010-05-12 Thread HACKER Nora
Hi Thomas, > If you "use strict;" you may not use symbolic references, i.e. (mis)use > a variable's name to create a reference to it. That's why I fixed your > code > by replacing the variable names with references to the variable I > assumed you'd wish to address. > > Maybe you should take a loo

AW: Hash with variable name

2010-05-12 Thread Thomas Bätzler
HACKER Nora asked: > > Try: > > > > my %stp_dirs = ('mvb' => \%mvb_dirs, > > 'pkv' => \%pkv_dirs, > > 'av' => \%av_dirs, > > 'be' => \%be_dirs, > > 'vvw' => \%vvw_dirs ); > > > > while ( my($sdir,$tdir) = each %{$s

AW: Hash with variable name

2010-05-12 Thread HACKER Nora
Hi Thomas, > Try: > > my %stp_dirs = ( 'mvb' => \%mvb_dirs, > 'pkv' => \%pkv_dirs, > 'av' => \%av_dirs, > 'be' => \%be_dirs, > 'vvw' => \%vvw_dirs ); > > while ( my($sdir,$tdir) = each %{$stp_dirs{'mvb'}}

AW: Hash with variable name

2010-05-12 Thread Thomas Bätzler
HACKER Nora wrote: > The script is being started with a parameter $stp (among others) that > can be one of mvb/pkv/av/be/vvw. This parameter is used as a key for a > master hash the values of which are names of other hashes themselves. > > # Master-Hash > my %stp_dirs = ( "mvb" => "mvb_dirs", >