Kevin Horton wrote: > I'm a perl newbie working on a script to log data from a device that > sends more variables than I need to log. I have a working prototype > script, with the list of variables to be logged hard-coded, which > means I need to edit the script any time I need to change the items > to be printed. > > Now I want to extend the script to use a configuration file to define > the list of variables to be logged, and the order to write them to the > log file. I've been messing around with this for many hours, and I've > dug through the various perl man pages, plus Perl in a Nutshell, and > Programming Perl, but I'm not making any progress. > > My working prototype script with the hard-coded list of variables > prints output with the following line: > > print OUTPUT > "$data_time\t$TACH\t$MP\t$FUEL_FLOW\t$QTY\t$CHT1\t$CHT2\t$CHT3\t$CHT4\t$ > EGT1\t$EGT2\t$EGT3\t$EGT4\t$OILT\t$OILP\t$VOLT\t$OAT\t$UNIT_TEMP\n"; > > I've got a config file that I read to create an array of variable > names that should be logged. The first few items in @variable_list > are: > > data_time > TACH > MP > FUEL_FLOW > > I would greatly appreciate any hints on how I can use the data in > @variable_list to print just the variables I want.
Kevin, I would change it to a hash and then either use some type of regex against the keys to get what you want to print out or bypass. Wags ;) > > Thanks in advance, > > Kevin Horton ******************************************************* This message contains information that is confidential and proprietary to FedEx Freight or its affiliates. It is intended only for the recipient named and for the express purpose(s) described therein. Any other use is prohibited. ******************************************************* -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>