I use anonymouse variables all the time. Basically in dynamic database applications. 
It makes very complicated things a bit easier :

@files = `ls /home/user`;


foreach $file(@files) {
        
        open file...
        @$file = <FILEHANDLE>;
        close file...
}

Open fileto contrain contents of all files ...
foreach $file(@files) {
        
        print FILEHANDLE2 "\n ------ begin $file ----- \n";
        print FILEHANDLE2 @$file;
        print FILEHANDLE2 "\n ------ end $file ----- \n";
}
Close fileto contrain contents of all files...


Just a quick example

Dan
-----Original Message-----
From: Paul Kraus [mailto:[EMAIL PROTECTED]] 
Sent: Friday, January 03, 2003 2:02 PM
To: 'Perl'
Subject: References ch 8 programming Perl


Ok a couple questions on Ref from pg 251 programming Perl.

push @$arrrayref,$filename);
$$arrayref[0]="January";
@$arrayref[4..6]=qw/May June July/;

So this is actually creating an anonymous array that it then references correct? so 
the assignments January ect are being made to an anonymous array.

This is cool but maybe I am missing the point. Why would you use these references 
rather then just using the actual variable? If some one could give me some real world 
applications for this I would be most appreciative.

I have seen them used to simulate a multidimensional array as well has hash and that 
makes sense. But beyond that I am kind of at a loss.

Paul Kraus
Network Administrator
PEL Supply Company
216.267.5775 Voice
216-267-6176 Fax
www.pelsupply.com


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to