> Mr.David, > I have few questions: > 1. What is the function of Scope Resolution Operator :: used > in the code you sent me? (filter::$col[$i]) > 2. What are the arguments for the sub routine "filterspec"? > you have put sub filterspec($@). > 3. What is the output expected out of "map{ $e =~ > s/\b$_\b/filter::$_()/g } @col;"?
Hello. Sorry about the Delay. My son was born Sunday and we've been in and out of hospital for a week. The 'scope resolution operator' in this case it FORCING the declaration of all variables (x1, y1, y2 etc) to be in the 'filter' namespace.. This (a) prevents conflict with current local or global variables, and (b) allows the 'filter_data' code to lock the filter expression into the 'filter' namespace and prevent access to global variables or functions (it does not do this thought. Doing so would be your task. perldoc 'Safe' for more info) The filterspec function tasks a 'code reference' and an array. Note that the '$@' is a prototype, and prototypes don't mean the same thing to perl. Its really just means that there is a minimum of two arguments and no maximum. The 'map' call takes the evaluation expression (in $e) and does the following: ( x1 < 1000 ) && ( y1 > 30000 ) becomes (filter::x1() < 1000) && (filter::y1() > 30000) Each element in '@col' is placed into '$_' and used to substitute '$_' with 'filter::'$_'()' So you see, it converts each reference to a column into a function call which finds the data for that column. This is important, because otherwise the filter expression is not valid perl. hope that helps. Cheers. > > > Can you please clarify me these things? Your kind help is solicited. > > Thanks > Regards > Guruguhan > EACoE, India. > * - *91-80-5031516 > * - *901-1516 ( Dial Com) > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>