search for: lookup_csv

Displaying 1 result from an estimated 1 matches for "lookup_csv".

2007 Jun 06
2
lookup in CSV recipe
...er, I have this sort of ugliness: $site = $hostname ? { fred => "opsera", barney => "bedrock", default => "unknown site", ... } So I''ve knocked up this little function to use CSV files instead. Now I can just do: $site = lookup_csv("sites.csv",$hostname,"site") where sites.csv is: hostname,site,ip fred,opsera,192.168.1.1 barney,bedrock,10.0.0.1 This is much nicer IMO - in particular I only need to change a .csv file. That file is likely to be exported from a spreadsheet which makes life even easier (lat...