Another thing I use a lot is to take form input and build sql queries based on what is input for instance Say I want to search a table withh twenty columns If I have a form with all 20 columns that they can enter something to look for in each field thay will probably only use a few so I go
@params = $cgi->params; $where = "WHERE"; Foreach $p(@params) { $where .= " $p=\'$cgi->param($p)\' AND"; } $where =~ s/AND$//; $query = "SELECT FROM tablemonkey $where"; Execute $query.... Or without annoymous references I could always go If($cgi->param('joemama')) { $where .= " joemama=\'$cgi->param('joemama')\'"; } If($cgi....... For all twenty, which would be time consuming and then what if I change the table? I have to go in and modift this everytime which will make it more likelyt errors will creep in and is just big and ugly Anywho hope that helps Dan -----Original Message----- From: Dan Muey Sent: Friday, January 03, 2003 3:17 PM To: Perl Subject: RE: References ch 8 programming Perl 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]